Class: TwitterCldr::Formatters::Rbnf::MasterRuleFormatter
Instance Attribute Summary
#is_fractional, #locale, #omit, #rule_group, #rule_set
Instance Method Summary
collapse
#equals, #format, #generate_replacement, #initialize, #plaintext, #semicolon
Instance Method Details
#close_bracket(number, rule, token) ⇒ Object
192
193
194
195
|
# File 'lib/twitter_cldr/formatters/numbers/rbnf/formatters.rb', line 192
def close_bracket(number, rule, token)
@omit = false
""
end
|
#left_arrow(number, rule, token) ⇒ Object
169
170
171
172
173
174
175
176
177
178
179
|
# File 'lib/twitter_cldr/formatters/numbers/rbnf/formatters.rb', line 169
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
181
182
183
184
185
186
187
188
189
190
|
# File 'lib/twitter_cldr/formatters/numbers/rbnf/formatters.rb', line 181
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
157
158
159
160
161
162
163
164
165
166
167
|
# File 'lib/twitter_cldr/formatters/numbers/rbnf/formatters.rb', line 157
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
|