Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
@shime

This comment has been minimized.

Copy link

@shime shime commented Apr 8, 2012

thanks for this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment