Module: Flt::MathBase::ClassMethods

Defined in:
lib/flt/math.rb

Instance Method Summary collapse

Instance Method Details

#math_function(*fs) ⇒ Object



39
40
41
42
43
44
45
46
# File 'lib/flt/math.rb', line 39

def math_function(*fs)
  fs.each do |f|
    define_method f do |*args|
      context.send f, *args
    end
    module_function f
  end
end

#num_class(cls, &blk) ⇒ Object



30
31
32
33
34
35
36
37
38
# File 'lib/flt/math.rb', line 30

def num_class(cls, &blk)
  define_method(:num_class){cls}
  if blk
    define_method(:context, &blk)
  else
    define_method(:context){num_class.context}
  end
  module_function :num_class, :context
end