Class: Number
Instance Method Summary collapse
- #to_int ⇒ Object
- #valid_type(prm) ⇒ Object
-
#~ ⇒ Object
make sure capture did not muck things up.
Methods inherited from ValueAdd
bestow_methods, capture_base_methods
Methods inherited from Value
#!=, #==, #ensure_valid, #freeze, freeze_raise?, ignore_on_freeze, #initialize, #inspect, #prim_value, raise_on_freeze, #replace, #to_s, #to_wrapper, #type, #type_of?, #unwrap, #val, #val=, #wrapped?
Constructor Details
This class inherits a constructor from Value
Instance Method Details
#to_int ⇒ Object
516 517 518 |
# File 'lib/primitive_wrapper.rb', line 516 def to_int Int.new @value.to_i end |
#valid_type(prm) ⇒ Object
508 509 510 511 512 |
# File 'lib/primitive_wrapper.rb', line 508 def valid_type(prm) return true if prm.kind_of? Numeric return true if prm.kind_of? Number false end |
#~ ⇒ Object
make sure capture did not muck things up
513 514 515 |
# File 'lib/primitive_wrapper.rb', line 513 def ~ # make sure capture did not muck things up @value # If you need ~ use Int instead of Number end |