Class: Coradoc::Element::Attribute
- Defined in:
- lib/coradoc/element/attribute.rb
Instance Attribute Summary collapse
-
#key ⇒ Object
Returns the value of attribute key.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
- #extensions_value?(value) ⇒ Boolean
-
#initialize(key, value, _options = {}) ⇒ Attribute
constructor
A new instance of Attribute.
Methods inherited from Base
access_children, #children_accessors, children_accessors, declare_children, #simplify_block_content, visit, #visit
Constructor Details
#initialize(key, value, _options = {}) ⇒ Attribute
Returns a new instance of Attribute.
6 7 8 9 10 11 12 13 |
# File 'lib/coradoc/element/attribute.rb', line 6 def initialize(key, value, = {}) @key = key.to_s @value = if extensions_value?(value.to_s) build_values(value.to_s) else value.to_s.strip end end |
Instance Attribute Details
#key ⇒ Object
Returns the value of attribute key.
4 5 6 |
# File 'lib/coradoc/element/attribute.rb', line 4 def key @key end |
#value ⇒ Object
Returns the value of attribute value.
4 5 6 |
# File 'lib/coradoc/element/attribute.rb', line 4 def value @value end |
Instance Method Details
#extensions_value?(value) ⇒ Boolean
15 16 17 18 |
# File 'lib/coradoc/element/attribute.rb', line 15 def extensions_value?(value) v = value.split(",").map(&:strip) v.intersect? %w[xml html pdf xml adoc rxl] end |