Class: DACPClient::TagDefinition

Inherits:
Struct
  • Object
show all
Defined in:
lib/dacpclient/tag_definition.rb,
lib/dacpclient/tag_definitions.rb

Overview

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



6
7
8
# File 'lib/dacpclient/tag_definition.rb', line 6

def name
  @name
end

#tagObject

Returns the value of attribute tag

Returns:

  • (Object)

    the current value of tag



6
7
8
# File 'lib/dacpclient/tag_definition.rb', line 6

def tag
  @tag
end

#typeObject

Returns the value of attribute type

Returns:

  • (Object)

    the current value of type



6
7
8
# File 'lib/dacpclient/tag_definition.rb', line 6

def type
  @type
end

Class Method Details

.find(key) ⇒ Object Also known as: []



16
17
18
# File 'lib/dacpclient/tag_definition.rb', line 16

def find(key)
  @@tags[key.to_s]
end

.tag(*args, &block) ⇒ Object



20
21
22
23
24
# File 'lib/dacpclient/tag_definition.rb', line 20

def tag(*args, &block)
  @@tags ||= Hash.new(nil)
  definition = new(*args, &block).freeze
  @@tags[definition.tag.to_s] = definition
end

Instance Method Details

#inspectObject



7
8
9
# File 'lib/dacpclient/tag_definition.rb', line 7

def inspect
  "#{tag} (#{name}: #{type})"
end

#to_sObject



11
12
13
# File 'lib/dacpclient/tag_definition.rb', line 11

def to_s
  "#{tag} (#{name}: #{type})"
end