Class: Grumlin::Property

Inherits:
Object
  • Object
show all
Defined in:
lib/grumlin/property.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ Property

Returns a new instance of Property.



6
7
8
9
# File 'lib/grumlin/property.rb', line 6

def initialize(value)
  @key = value[:key]
  @value = Grumlin::Typing.cast(value[:value])
end

Instance Attribute Details

#keyObject (readonly)

Returns the value of attribute key.



4
5
6
# File 'lib/grumlin/property.rb', line 4

def key
  @key
end

#valueObject (readonly)

Returns the value of attribute value.



4
5
6
# File 'lib/grumlin/property.rb', line 4

def value
  @value
end

Instance Method Details

#==(other) ⇒ Object



19
20
21
# File 'lib/grumlin/property.rb', line 19

def ==(other)
  self.class == other.class && @key == other.key && @value == other.value
end

#inspectObject



11
12
13
# File 'lib/grumlin/property.rb', line 11

def inspect
  "p[#{key}->#{value}]"
end

#to_sObject



15
16
17
# File 'lib/grumlin/property.rb', line 15

def to_s
  inspect
end