Module: MetaStuff
- Included in:
- KasPay
- Defined in:
- lib/meta_stuff.rb
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *args, &block) ⇒ Object
2
3
4
|
# File 'lib/meta_stuff.rb', line 2
def method_missing(m, *args, &block)
raise NoMethodError, "undefined method `#{m}' for #{self}:#{self.class}"
end
|
Instance Method Details
#before(names, &block) ⇒ Object
6
7
8
9
10
11
12
13
14
15
16
|
# File 'lib/meta_stuff.rb', line 6
def before(names, &block)
names.each do |name|
m = instance_method(name)
n = instance_method(yield)
define_method(name) do
n.bind(self).call
m.bind(self).call
end
end
private yield
end
|