Module: Kernel
- Defined in:
- lib/differentiation/ext/kernel.rb
Instance Method Summary collapse
Instance Method Details
#differential(m) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/differentiation/ext/kernel.rb', line 4 def differential(m) if m.is_a?(Symbol) f = self.method(m) elsif m.is_a?(Proc) or m.is_a?(Method) f = m else raise TypeError, "differential requires Method/Proc/Symbol argument." end f = Differentiation.differential(f) if m.is_a?(Symbol) if self.is_a?(Module) self.define_method(m, f) else self.define_singleton_method(m, f) end end f end |