Class: ValueAdd

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

Direct Known Subclasses

Datum, FloatW, Fraction, Int, Number, XArray, XRange

Class Method Summary collapse

Instance Method Summary collapse

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

Class Method Details

.bestow_methods(*args) ⇒ Object



447
448
449
450
451
452
453
454
# File 'lib/primitive_wrapper.rb', line 447

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



455
456
457
458
# File 'lib/primitive_wrapper.rb', line 455

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



444
445
446
# File 'lib/primitive_wrapper.rb', line 444

def valid_type(prm) # must override
  false
end