Class: XMLable::Exports::Base
- Inherits:
-
Object
- Object
- XMLable::Exports::Base
- Defined in:
- lib/xmlable/exports/base.rb
Overview
Base class contains the base export logic
Direct Known Subclasses
Instance Method Summary collapse
-
#described?(node) ⇒ Boolean
Is the object described by user?.
-
#empty?(node) ⇒ Boolean
Is this object empty?.
-
#initialize(element, opts = {}) ⇒ Base
constructor
Initialize.
-
#node_merged_opts(node, opts = Options::Storage.new) ⇒ XMLable::Options::Storage
Merge node’s options.
-
#node_nested_options(node) ⇒ XMLable::Options::Storage
Get node’s nested options.
-
#node_options(node) ⇒ XMLable::Options::Storage
Get node’s options.
Constructor Details
#initialize(element, opts = {}) ⇒ Base
Initialize
13 14 15 16 |
# File 'lib/xmlable/exports/base.rb', line 13 def initialize(element, opts = {}) @element = element @opts = opts end |
Instance Method Details
#described?(node) ⇒ Boolean
Is the object described by user?
36 37 38 |
# File 'lib/xmlable/exports/base.rb', line 36 def described?(node) node.instance_variable_get(:@__handler).described? end |
#empty?(node) ⇒ Boolean
Is this object empty?
25 26 27 |
# File 'lib/xmlable/exports/base.rb', line 25 def empty?(node) node.instance_variable_get(:@__element).__empty? end |
#node_merged_opts(node, opts = Options::Storage.new) ⇒ XMLable::Options::Storage
Merge node’s options
73 74 75 |
# File 'lib/xmlable/exports/base.rb', line 73 def node_merged_opts(node, opts = Options::Storage.new) opts.merge_opts((node)) end |
#node_nested_options(node) ⇒ XMLable::Options::Storage
Get node’s nested options
47 48 49 50 51 |
# File 'lib/xmlable/exports/base.rb', line 47 def (node) return Options::Storage.new unless node parent = node.respond_to?(:parent) ? node.parent : nil (parent).merge_opts((node)) end |
#node_options(node) ⇒ XMLable::Options::Storage
Get node’s options
60 61 62 63 |
# File 'lib/xmlable/exports/base.rb', line 60 def (node) h = node.instance_variable_get(:@__handler) h && h. ? h. : Options::Storage.new end |