Class: Starry::Item

Inherits:
Object
  • Object
show all
Defined in:
lib/starry/item.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value, parameters = {}) ⇒ Item

Returns a new instance of Item.



5
6
7
8
# File 'lib/starry/item.rb', line 5

def initialize(value, parameters = {})
  @value = value
  @parameters = parameters
end

Instance Attribute Details

#parametersObject

Returns the value of attribute parameters.



3
4
5
# File 'lib/starry/item.rb', line 3

def parameters
  @parameters
end

#valueObject

Returns the value of attribute value.



3
4
5
# File 'lib/starry/item.rb', line 3

def value
  @value
end

Instance Method Details

#==(other) ⇒ Object



10
11
12
# File 'lib/starry/item.rb', line 10

def ==(other)
  self.class == other.class && self.value == other.value && self.parameters == other.parameters
end

#deconstruct_keys(keys) ⇒ Object



18
19
20
# File 'lib/starry/item.rb', line 18

def deconstruct_keys(keys)
  { value: @value, parameters: @parameters }
end

#to_sObject



14
15
16
# File 'lib/starry/item.rb', line 14

def to_s
  "#{ Starry.serialize_bare_item(value) }#{ Starry.serialize_parameters(parameters) }"
end