Class: MessageFormat::Compiler
- Inherits:
-
Object
- Object
- MessageFormat::Compiler
- Defined in:
- lib/messageformat.rb
Defined Under Namespace
Classes: CompileError
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#locale ⇒ Object
readonly
Returns the value of attribute locale.
-
#messages ⇒ Object
readonly
Returns the value of attribute messages.
-
#strict ⇒ Object
readonly
Returns the value of attribute strict.
Instance Method Summary collapse
- #compile ⇒ Object
-
#initialize(locale, messages, strict: true) ⇒ Compiler
constructor
A new instance of Compiler.
Constructor Details
#initialize(locale, messages, strict: true) ⇒ Compiler
Returns a new instance of Compiler.
17 18 19 20 21 22 |
# File 'lib/messageformat.rb', line 17 def initialize(locale, , strict: true) @locale = locale @messages = @strict = strict @context = init_context end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
15 16 17 |
# File 'lib/messageformat.rb', line 15 def context @context end |
#locale ⇒ Object (readonly)
Returns the value of attribute locale.
15 16 17 |
# File 'lib/messageformat.rb', line 15 def locale @locale end |
#messages ⇒ Object (readonly)
Returns the value of attribute messages.
15 16 17 |
# File 'lib/messageformat.rb', line 15 def @messages end |
#strict ⇒ Object (readonly)
Returns the value of attribute strict.
15 16 17 |
# File 'lib/messageformat.rb', line 15 def strict @strict end |
Instance Method Details
#compile ⇒ Object
24 25 26 27 28 |
# File 'lib/messageformat.rb', line 24 def compile context.call("compileMessageFormat", locale, , strict) rescue MiniRacer::RuntimeError => e raise CompileError.new(cause: e) end |