Class: ValueAdd
Class Method Summary collapse
Instance Method Summary collapse
-
#valid_type(prm) ⇒ Object
must override.
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
Class Method Details
.bestow_methods(*args) ⇒ Object
343 344 345 346 347 348 349 350 |
# File 'lib/primitive_wrapper.rb', line 343 def self.bestow_methods(*args) args = args.first if args.first.kind_of? Array args.each do |meth| define_method meth do |*args, &block| @value.send(meth, *args, &block) end end end |
.capture_base_methods(type, except = Object) ⇒ Object
351 352 353 354 |
# File 'lib/primitive_wrapper.rb', line 351 def self.capture_base_methods(type, except=Object) add_me = type.instance_methods - except.instance_methods - Value.instance_methods - [:singleton_method_added] bestow_methods add_me end |
Instance Method Details
#valid_type(prm) ⇒ Object
must override
340 341 342 |
# File 'lib/primitive_wrapper.rb', line 340 def valid_type(prm) # must override false end |