Module: DelegateAccessors::ClassMethods

Defined in:
lib/delegate_accessors.rb

Instance Method Summary collapse

Instance Method Details

#delegate_accessors(*methods) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/delegate_accessors.rb', line 9

def delegate_accessors(*methods)
  options = methods.pop

  accessors = methods.reduce([]) do |acc, method|
    acc + [method, "#{method}="]
  end

  delegate *(accessors << options)
end