Class: MessageFormat::MessageFormat
- Inherits:
-
Object
- Object
- MessageFormat::MessageFormat
- Defined in:
- lib/message_format.rb
Instance Method Summary collapse
- #format(args = nil) ⇒ Object
-
#initialize(pattern, locale = nil) ⇒ MessageFormat
constructor
A new instance of MessageFormat.
Constructor Details
#initialize(pattern, locale = nil) ⇒ MessageFormat
Returns a new instance of MessageFormat.
9 10 11 12 13 14 15 |
# File 'lib/message_format.rb', line 9 def initialize ( pattern, locale=nil ) @locale = (locale || TwitterCldr.locale).to_sym @format = Interpreter.interpret( Parser.parse(pattern), { :locale => @locale } ) end |
Instance Method Details
#format(args = nil) ⇒ Object
17 18 19 |
# File 'lib/message_format.rb', line 17 def format ( args=nil ) @format.call(args) end |