Class: DataFormatter::ValuePair
- Inherits:
-
Object
- Object
- DataFormatter::ValuePair
- Defined in:
- lib/data_formatter/value_pair.rb
Instance Attribute Summary collapse
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(args) ⇒ ValuePair
constructor
A new instance of ValuePair.
- #to_s ⇒ Object
Constructor Details
#initialize(args) ⇒ ValuePair
Returns a new instance of ValuePair.
6 7 8 9 |
# File 'lib/data_formatter/value_pair.rb', line 6 def initialize(args) @key = args.fetch(:key) @value = args.fetch(:value) end |
Instance Attribute Details
#key ⇒ Object (readonly)
Returns the value of attribute key.
4 5 6 |
# File 'lib/data_formatter/value_pair.rb', line 4 def key @key end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
4 5 6 |
# File 'lib/data_formatter/value_pair.rb', line 4 def value @value end |
Instance Method Details
#to_s ⇒ Object
11 12 13 |
# File 'lib/data_formatter/value_pair.rb', line 11 def to_s [key.to_s, '<span class="hashrocket"> => </span>', value.to_s].join end |