Skip to content

💪 Extends forwardable with delegation to hashes and instance variables.

License

Notifications You must be signed in to change notification settings

envygeeks/forwardable-extended

Repository files navigation

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.

About

💪 Extends forwardable with delegation to hashes and instance variables.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages