Class: TunecoreAnnouncer::CommandDictionary
- Inherits:
-
Object
- Object
- TunecoreAnnouncer::CommandDictionary
- Defined in:
- lib/tunecore-announcer/command_dictionary.rb
Instance Attribute Summary collapse
-
#dictionary ⇒ Object
readonly
Returns the value of attribute dictionary.
Instance Method Summary collapse
-
#initialize(yaml_filename) ⇒ CommandDictionary
constructor
A new instance of CommandDictionary.
- #load_dictionary(yaml_filename) ⇒ Object
- #lookup(message) ⇒ Object
Constructor Details
#initialize(yaml_filename) ⇒ CommandDictionary
Returns a new instance of CommandDictionary.
7 8 9 10 |
# File 'lib/tunecore-announcer/command_dictionary.rb', line 7 def initialize(yaml_filename) @logger = TunecoreAnnouncer::Logger.instance load_dictionary(yaml_filename) end |
Instance Attribute Details
#dictionary ⇒ Object (readonly)
Returns the value of attribute dictionary.
5 6 7 |
# File 'lib/tunecore-announcer/command_dictionary.rb', line 5 def dictionary @dictionary end |
Instance Method Details
#load_dictionary(yaml_filename) ⇒ Object
12 13 14 15 16 |
# File 'lib/tunecore-announcer/command_dictionary.rb', line 12 def load_dictionary(yaml_filename) @logger.info "Loading command dictionary: #{yaml_filename}" @dictionary = YAML.load_file(yaml_filename) @logger.debug @dictionary.inspect end |
#lookup(message) ⇒ Object
18 19 20 |
# File 'lib/tunecore-announcer/command_dictionary.rb', line 18 def lookup() @dictionary[] end |