Class: Int
Instance Method Summary collapse
-
#dec ⇒ Object
simulates post-deccrement.
-
#inc ⇒ Object
simulates post-increment.
- #to_int ⇒ Object
- #valid_type(prm) ⇒ Object
- #~ ⇒ Object
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
#dec ⇒ Object
simulates post-deccrement
368 369 370 371 |
# File 'lib/primitive_wrapper.rb', line 368 def dec # simulates post-deccrement @value-= 1 return @value+1 end |
#inc ⇒ Object
simulates post-increment
364 365 366 367 |
# File 'lib/primitive_wrapper.rb', line 364 def inc # simulates post-increment @value+= 1 return @value-1 end |
#to_int ⇒ Object
372 373 374 |
# File 'lib/primitive_wrapper.rb', line 372 def to_int self end |
#valid_type(prm) ⇒ Object
359 360 361 362 363 |
# File 'lib/primitive_wrapper.rb', line 359 def valid_type(prm) return true if prm.kind_of? Integer return true if prm.kind_of? Int false end |
#~ ⇒ Object
375 376 377 |
# File 'lib/primitive_wrapper.rb', line 375 def ~ ~@value end |