Class: CldrPlurals::Compiler::RuleList
- Inherits:
-
Object
- Object
- CldrPlurals::Compiler::RuleList
- Defined in:
- lib/cldr-plurals/compiler.rb
Instance Attribute Summary collapse
-
#locale ⇒ Object
readonly
Returns the value of attribute locale.
-
#rules ⇒ Object
readonly
Returns the value of attribute rules.
Instance Method Summary collapse
- #add_rule(name, rule_string) ⇒ Object
-
#initialize(locale) ⇒ RuleList
constructor
A new instance of RuleList.
- #to_code(prog_lang) ⇒ Object
Constructor Details
#initialize(locale) ⇒ RuleList
12 13 14 15 |
# File 'lib/cldr-plurals/compiler.rb', line 12 def initialize(locale) @locale = locale @rules = [] end |
Instance Attribute Details
#locale ⇒ Object (readonly)
Returns the value of attribute locale.
10 11 12 |
# File 'lib/cldr-plurals/compiler.rb', line 10 def locale @locale end |
#rules ⇒ Object (readonly)
Returns the value of attribute rules.
10 11 12 |
# File 'lib/cldr-plurals/compiler.rb', line 10 def rules @rules end |
Instance Method Details
#add_rule(name, rule_string) ⇒ Object
17 18 19 20 21 22 |
# File 'lib/cldr-plurals/compiler.rb', line 17 def add_rule(name, rule_string) rule = Parser.new(Tokenizer.tokenize(rule_string)).parse rule.name = name rules << rule nil end |
#to_code(prog_lang) ⇒ Object
24 25 26 27 |
# File 'lib/cldr-plurals/compiler.rb', line 24 def to_code(prog_lang) emitter = find_emitter(prog_lang) emitter.emit_rules(self) end |