Module: CldrPlurals::RubyRuntime
- Defined in:
- lib/cldr-plurals/ruby_runtime.rb,
lib/cldr-plurals/ruby-runtime/str_num.rb
Defined Under Namespace
Classes: StrNum
Class Method Summary collapse
- .build_args_for(num_str) ⇒ Object
- .e(num) ⇒ Object
-
.f(num) ⇒ Object
visible fractional digits in n, with trailing zeros.
-
.i(num) ⇒ Object
integer digits of n.
-
.n(num) ⇒ Object
absolute value of the source number (integer and decimals).
-
.t(num) ⇒ Object
visible fractional digits in n, without trailing zeros.
-
.v(num) ⇒ Object
number of visible fraction digits in n, with trailing zeros.
-
.w(num) ⇒ Object
number of visible fraction digits in n, without trailing zeros.
Class Method Details
.build_args_for(num_str) ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/cldr-plurals/ruby_runtime.rb', line 9 def build_args_for(num_str) num = StrNum.from_string(num_str) [ n(num), i(num), f(num), t(num), v(num), w(num), e(num) ] end |
.e(num) ⇒ Object
49 50 51 |
# File 'lib/cldr-plurals/ruby_runtime.rb', line 49 def e(num) wrap(num).exp end |
.f(num) ⇒ Object
visible fractional digits in n, with trailing zeros.
30 31 32 |
# File 'lib/cldr-plurals/ruby_runtime.rb', line 30 def f(num) wrap(num).apply_exp.frac_val.to_i end |
.i(num) ⇒ Object
integer digits of n.
25 26 27 |
# File 'lib/cldr-plurals/ruby_runtime.rb', line 25 def i(num) wrap(num).apply_exp.int_val end |
.n(num) ⇒ Object
absolute value of the source number (integer and decimals).
20 21 22 |
# File 'lib/cldr-plurals/ruby_runtime.rb', line 20 def n(num) wrap(num).abs.strip.to_val end |
.t(num) ⇒ Object
visible fractional digits in n, without trailing zeros.
35 36 37 |
# File 'lib/cldr-plurals/ruby_runtime.rb', line 35 def t(num) wrap(num).apply_exp.strip.frac_val.to_i end |
.v(num) ⇒ Object
number of visible fraction digits in n, with trailing zeros.
40 41 42 |
# File 'lib/cldr-plurals/ruby_runtime.rb', line 40 def v(num) wrap(num).apply_exp.frac.length end |
.w(num) ⇒ Object
number of visible fraction digits in n, without trailing zeros.
45 46 47 |
# File 'lib/cldr-plurals/ruby_runtime.rb', line 45 def w(num) wrap(num).apply_exp.strip.frac_val.length end |