Class: DataFormatter::ValuePair

Inherits:
Object
  • Object
show all
Defined in:
lib/data_formatter/value_pair.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#keyObject (readonly)

Returns the value of attribute key.



4
5
6
# File 'lib/data_formatter/value_pair.rb', line 4

def key
  @key
end

#valueObject (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_sObject



11
12
13
# File 'lib/data_formatter/value_pair.rb', line 11

def to_s
  [key.to_s, '<span class="hashrocket">&nbsp;=&gt;&nbsp;</span>', value.to_s].join
end