Created
February 25, 2012 00:09
-
-
Save selman/1904776 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
thanks for this!