Class: DACPClient::Tag
- Inherits:
-
Struct
- Object
- Struct
- DACPClient::Tag
- Defined in:
- lib/dacpclient/tag.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#type ⇒ Object
Returns the value of attribute type.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
Instance Attribute Details
#type ⇒ Object
Returns the value of attribute type
2 3 4 |
# File 'lib/dacpclient/tag.rb', line 2 def type @type end |
#value ⇒ Object
Returns the value of attribute value
2 3 4 |
# File 'lib/dacpclient/tag.rb', line 2 def value @value end |
Instance Method Details
#inspect(level = 0) ⇒ Object
7 8 9 |
# File 'lib/dacpclient/tag.rb', line 7 def inspect(level = 0) "#{' ' * level}#{type}: #{value}" end |
#to_dmap ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/dacpclient/tag.rb', line 11 def to_dmap value = self.value if type.type == :container value = value.reduce('') { |a, e| a + e.to_dmap } else value = DMAPConverter.encode(type.type, value) end type.tag.to_s + [value.length].pack('N') + value end |
#to_s ⇒ Object
3 4 5 |
# File 'lib/dacpclient/tag.rb', line 3 def to_s "#<#{self.class.name} #{type}>" end |