Module: Lab42::AOP::Meta

Extended by:
Meta
Included in:
Meta
Defined in:
lib/lab42/aop/meta.rb

Instance Method Summary collapse

Instance Method Details

#add_attribute(objct, att_name) ⇒ Object



11
12
13
14
15
16
# File 'lib/lab42/aop/meta.rb', line 11

def add_attribute objct, att_name
  class << objct; self end.module_eval do
    attr_accessor att_name
  end
  objct
end

#add_singleton_method(objct, name, &method) ⇒ Object



4
5
6
7
8
9
# File 'lib/lab42/aop/meta.rb', line 4

def add_singleton_method objct, name, &method
  class << objct; self end.module_eval do
    define_method name, &method
  end
  objct
end