Class: TwitterCldr::Formatters::Rbnf::MasterRuleFormatter
Instance Attribute Summary
#is_fractional, #locale, #omit, #rule_group, #rule_set
Instance Method Summary
collapse
#decimal, #equals, #format, #generate_replacement, #initialize, #plaintext, #plural, #semicolon
Instance Method Details
#close_bracket(number, rule, token) ⇒ Object
207
208
209
210
|
# File 'lib/twitter_cldr/formatters/numbers/rbnf/formatters.rb', line 207
def close_bracket(number, rule, token)
@omit = false
""
end
|
#left_arrow(number, rule, token) ⇒ Object
184
185
186
187
188
189
190
191
192
193
194
|
# File 'lib/twitter_cldr/formatters/numbers/rbnf/formatters.rb', line 184
def left_arrow(number, rule, token)
if is_fractional
RuleFormatter.format(
(number * fractional_rule(number).base_value).to_i,
rule_set, rule_group, locale
)
else
generate_replacement(integral_part(number), rule, token)
end
end
|
#open_bracket(number, rule, token) ⇒ Object
196
197
198
199
200
201
202
203
204
205
|
# File 'lib/twitter_cldr/formatters/numbers/rbnf/formatters.rb', line 196
def open_bracket(number, rule, token)
@omit = if is_fractional
(number * fractional_rule(number).base_value) == 1
else
@omit = number.is_a?(Integer)
end
""
end
|
#right_arrow(number, rule, token) ⇒ Object
172
173
174
175
176
177
178
179
180
181
182
|
# File 'lib/twitter_cldr/formatters/numbers/rbnf/formatters.rb', line 172
def right_arrow(number, rule, token)
is_fractional = true
number.to_s.split(".")[1].each_char.map do |digit|
RuleFormatter.format(digit.to_i, rule_set, rule_group, locale)
end.join(" ")
end
|