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 << " def \#{name}(*args, &block)\n \#{to}.\#{name}(*args, &block)\n end\n RUBY\n end\n module_eval declarations\nend\n" |
#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 |