Module: ASpaceImport::XML::SAX::ClassMethods
- Defined in:
- backend/app/converters/lib/xml_sax.rb
Instance Method Summary (collapse)
-
- (Object) and_in_closing(path, &block)
-
- (Object) ensure_configuration
-
- (Object) handler_name(path, prefix = '')
-
- (Object) ignore(path)
-
- (Boolean) make_sticky?(node_name)
-
- (Object) with(path, &block)
Instance Method Details
- (Object) and_in_closing(path, &block)
29 30 31 |
# File 'backend/app/converters/lib/xml_sax.rb', line 29 def and_in_closing(path, &block) define_method(handler_name(path, "_closing"), block) end |
- (Object) ensure_configuration
39 40 41 42 43 44 45 |
# File 'backend/app/converters/lib/xml_sax.rb', line 39 def ensure_configuration @configured ||= false @stickies = [] unless @configured self.configure end end |
- (Object) handler_name(path, prefix = '')
13 14 15 16 17 18 19 20 21 22 23 |
# File 'backend/app/converters/lib/xml_sax.rb', line 13 def handler_name(path, prefix = '' ) @sticky_nodes ||= {} parts = path.split("/").reverse handler_name = prefix while parts.length > 1 @sticky_nodes[parts.last] = true handler_name << "_#{parts.pop}" end handler_name << "_#{parts.pop}" end |
- (Object) ignore(path)
33 34 35 36 |
# File 'backend/app/converters/lib/xml_sax.rb', line 33 def ignore(path) with(path) { @ignore = true } and_in_closing(path) { @ignore = false } end |
- (Boolean) make_sticky?(node_name)
47 48 49 |
# File 'backend/app/converters/lib/xml_sax.rb', line 47 def make_sticky?(node_name) @sticky_nodes[node_name] || false end |
- (Object) with(path, &block)
25 26 27 |
# File 'backend/app/converters/lib/xml_sax.rb', line 25 def with(path, &block) define_method(handler_name(path), block) end |