Class: Number

Inherits:
ValueAdd show all
Defined in:
lib/primitive_wrapper.rb

Instance Method Summary collapse

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, #unwrap, #val, #val=

Constructor Details

This class inherits a constructor from Value

Instance Method Details

#to_intObject



405
406
407
# File 'lib/primitive_wrapper.rb', line 405

def to_int
  Int.new @value.to_i
end

#valid_type(prm) ⇒ Object



397
398
399
400
401
# File 'lib/primitive_wrapper.rb', line 397

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



402
403
404
# File 'lib/primitive_wrapper.rb', line 402

def ~   # make sure capture did not muck things up
  @value   # If you need ~ use Int instead of Number
end