Class: Module
- Inherits:
-
Object
- Object
- Module
- Defined in:
- lib/famili/delegate.rb,
lib/famili/class_attribute.rb
Instance Method Summary collapse
Instance Method Details
#delegate(*method_names) ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/famili/delegate.rb', line 2 def delegate(*method_names) opts = method_names.pop declarations = '' to = opts[:to] method_names.each do |name| declarations << <<-RUBY def #{name}(*args, &block) #{to}.#{name}(*args, &block) end RUBY end module_eval declarations end |
#remove_possible_method(method) ⇒ Object
2 3 4 5 6 |
# File 'lib/famili/class_attribute.rb', line 2 def remove_possible_method(method) if method_defined?(method) || private_method_defined?(method) undef_method(method) end end |