Class: Numeric
- Defined in:
- lib/ruby/commons/core_ext/object/blank.rb,
lib/ruby/commons/core_ext/numeric/integer.rb,
lib/ruby/commons/core_ext/object/duplicable.rb
Overview
:nodoc:
Class Method Summary collapse
Instance Method Summary collapse
-
#mp_blank? ⇒ false
No number is blank:.
-
#mp_duplicable? ⇒ Boolean
Numbers are not duplicable:.
Class Method Details
.mp_is_int?(obj) ⇒ Boolean
TODO
4 5 6 7 |
# File 'lib/ruby/commons/core_ext/numeric/integer.rb', line 4 def self.mp_is_int?(obj) value = obj.to_s value.to_i.to_s == value end |
.mp_to_i(value, default = nil) ⇒ Object
TODO
11 12 13 |
# File 'lib/ruby/commons/core_ext/numeric/integer.rb', line 11 def self.mp_to_i(value, default = nil) mp_is_int?(value) ? value.to_i : default end |
Instance Method Details
#mp_blank? ⇒ false
No number is blank:
1.mp_blank? # => false
0.mp_blank? # => false
136 137 138 |
# File 'lib/ruby/commons/core_ext/object/blank.rb', line 136 def mp_blank? false end |
#mp_duplicable? ⇒ Boolean
Numbers are not duplicable:
3.mp_duplicable? # => false
3.dup # => TypeError: can't dup Fixnum
79 80 81 |
# File 'lib/ruby/commons/core_ext/object/duplicable.rb', line 79 def mp_duplicable? false end |