Module: Clamp::Messages

Included in:
Clamp
Defined in:
lib/clamp/messages.rb

Overview

Message lookup, to allow localization.

Instance Method Summary collapse

Instance Method Details

#clear_messages!Object



20
21
22
# File 'lib/clamp/messages.rb', line 20

def clear_messages!
  init_default_messages
end

#message(key, options = {}) ⇒ Object



13
14
15
16
17
18
# File 'lib/clamp/messages.rb', line 13

def message(key, options = {})
  string = messages.fetch(key)
  return string if options.empty?

  format string, options
end

#messages=(new_messages) ⇒ Object



9
10
11
# File 'lib/clamp/messages.rb', line 9

def messages=(new_messages)
  messages.merge!(new_messages)
end