Class: MessageManager

Inherits:
Object
  • Object
show all
Defined in:
lib/message_manager.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeMessageManager

Returns a new instance of MessageManager.



7
8
9
10
# File 'lib/message_manager.rb', line 7

def initialize
  strings_location = File.dirname(File.expand_path(__FILE__)) + "/strings.yml"
  @messages = YAML::load(File.open(strings_location))["messages"]
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m) ⇒ Object



12
13
14
# File 'lib/message_manager.rb', line 12

def method_missing(m)
  messages[m] ? messages[m] : super
end

Instance Attribute Details

#messagesObject (readonly)

Returns the value of attribute messages.



5
6
7
# File 'lib/message_manager.rb', line 5

def messages
  @messages
end