Class: Rekkyo::Type::Member
- Inherits:
-
Object
- Object
- Rekkyo::Type::Member
- Defined in:
- lib/rekkyo/type/member.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
- #==(other) ⇒ Object
- #as_json(options = nil) ⇒ Object
-
#initialize(key, value) ⇒ Member
constructor
A new instance of Member.
- #inspect ⇒ Object
- #match?(other) ⇒ Boolean (also: #===)
- #to_s ⇒ Object
Constructor Details
#initialize(key, value) ⇒ Member
Returns a new instance of Member.
8 9 10 11 |
# File 'lib/rekkyo/type/member.rb', line 8 def initialize(key, value) @key = key @value = value end |
Instance Attribute Details
#key ⇒ Object (readonly)
Returns the value of attribute key.
6 7 8 |
# File 'lib/rekkyo/type/member.rb', line 6 def key @key end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
6 7 8 |
# File 'lib/rekkyo/type/member.rb', line 6 def value @value end |
Instance Method Details
#==(other) ⇒ Object
13 14 15 16 17 |
# File 'lib/rekkyo/type/member.rb', line 13 def ==(other) self.class == other.class && self.key == other.key && self.value == other.value end |
#as_json(options = nil) ⇒ Object
41 42 43 |
# File 'lib/rekkyo/type/member.rb', line 41 def as_json( = nil) self.to_s.as_json() end |
#inspect ⇒ Object
32 33 34 |
# File 'lib/rekkyo/type/member.rb', line 32 def inspect "#{self.class.name || ''}::#{key}(#{value.inspect})" end |
#match?(other) ⇒ Boolean Also known as: ===
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/rekkyo/type/member.rb', line 19 def match?(other) case other when self.class self == other when String, Symbol self.value.to_s == other.to_s else self.value == other end end |
#to_s ⇒ Object
36 37 38 |
# File 'lib/rekkyo/type/member.rb', line 36 def to_s self.value.to_s end |