Skip to content

Instantly share code, notes, and snippets.

@kelvinlemus
Forked from selman/forwarding.rb
Created December 14, 2015 02:53
Show Gist options
  • Select an option

  • Save kelvinlemus/41374c175b30e03560b8 to your computer and use it in GitHub Desktop.

Select an option

Save kelvinlemus/41374c175b30e03560b8 to your computer and use it in GitHub Desktop.
require "forwardable"
class TheClass
extend Forwardable
attr_reader :items
def_delegators :@items, :<<, :push
def initialize; @items = [] end
end
x = TheClass.new
x << 'blue'
x.push 'orange'
x.items
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment