Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
require "forwardable"
class TheClass
extend Forwardable
attr_reader :items
def_delegators :@items, :<<, :push
def initialize; @items = [] end
x =
x << 'blue'
x.push 'orange'

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