Sha256: 547f54c0af9d2c16e46d0449cbb18d22dff417b8a15a6501976c64fa46705d9a
Contents?: true
Size: 625 Bytes
Versions: 4
Compression:
Stored size: 625 Bytes
Contents
require 'dmapparser/tag' require 'dmapparser/tag_container' module DMAPParser # The TagDefinition class describes the tags class TagDefinition < Struct.new(:tag, :type, :name) DEFINITIONS = Hash.new(nil) def to_s "#{tag} (#{name}: #{type})" end alias_method :inspect, :to_s def container? type == :container end class << self def find(key) DEFINITIONS[key.to_s] end def tag(*args, &block) definition = new(*args, &block).freeze DEFINITIONS[definition.tag.to_s] = definition end alias_method :[], :find end end end
Version data entries
4 entries across 4 versions & 1 rubygems