Class: DMAPParser::TagDefinition

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

Overview

Constant Summary collapse

DEFINITIONS =
Hash.new(nil)

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/dmapparser/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/dmapparser/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/dmapparser/tag_definition.rb', line 6

def type
  @type
end

Class Method Details

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



20
21
22
# File 'lib/dmapparser/tag_definition.rb', line 20

def find(key)
  DEFINITIONS[key.to_s]
end

.tag(*args, &block) ⇒ Object



24
25
26
27
# File 'lib/dmapparser/tag_definition.rb', line 24

def tag(*args, &block)
  definition = new(*args, &block).freeze
  DEFINITIONS[definition.tag.to_s] = definition
end

Instance Method Details

#container?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/dmapparser/tag_definition.rb', line 15

def container?
  type == :container
end

#to_sObject Also known as: inspect



9
10
11
# File 'lib/dmapparser/tag_definition.rb', line 9

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