Class: Karabiner::Property
- Inherits:
-
Object
- Object
- Karabiner::Property
- Includes:
- XmlTree
- Defined in:
- lib/karabiner/property.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#attr ⇒ Object
Returns the value of attribute attr.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(attr, value, options = {}) ⇒ Property
constructor
A new instance of Property.
- #to_xml ⇒ Object
Methods included from XmlTree
Constructor Details
#initialize(attr, value, options = {}) ⇒ Property
Returns a new instance of Property.
4 5 6 7 8 |
# File 'lib/karabiner/property.rb', line 4 def initialize(attr, value, = {}) @attr = attr.to_s @value = value = end |
Instance Attribute Details
#attr ⇒ Object
Returns the value of attribute attr.
9 10 11 |
# File 'lib/karabiner/property.rb', line 9 def attr @attr end |
#value ⇒ Object
Returns the value of attribute value.
9 10 11 |
# File 'lib/karabiner/property.rb', line 9 def value @value end |
Instance Method Details
#to_xml ⇒ Object
11 12 13 14 |
# File 'lib/karabiner/property.rb', line 11 def to_xml open_tag = .map { |a, v| "#{a}=\"#{v}\"" }.unshift(attr).join(" ") "<#{open_tag}>#{value}</#{attr}>" end |