/forwardable-extended

:muscle: Extends forwardable with delegation to hashes and instance variables.

Primary LanguageRubyMIT LicenseMIT

Build Status Test Coverage Code Climate Dependency Status

Forwardable Extended

Provides more Forwardable methods for your source as Forwardable::Extended.

class MyClass
  rb_delegate :method_name, :to => :@ivar, :type => :ivar, :boolean => true
  rb_delegate :method_name, :to => :@ivar, :type => :ivar, :boolean => :reverse
  rb_delegate :method_name, :to => :hash, :type => :hash, :key => :the_key
  rb_delegate :method_name_is_key, :to => :hash, :type => :hash
end
  • Any delegation can accept alias_of which will be the message sent to the object.
  • You can send arguments by attaching the keyword :args => [:my_arg], these are sent a #to_s message.
  • Any delegation can be boolean if you wish it to be, even :reverse.