Skip to content

Instantly share code, notes, and snippets.

@myronmarston
Created January 2, 2013 05:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save myronmarston/4432380 to your computer and use it in GitHub Desktop.
Save myronmarston/4432380 to your computer and use it in GitHub Desktop.
module Hamster
def self.vector(*args)
Vector.new(args)
end
class Vector < ::Array
alias add <<
end
end
describe Hamster::Vector do
describe "#add" do
def vector(*args)
Hamster.vector(*args)
end
let(:empty) { vector }
it "preserves the original" do
v = empty
v.add("A")
v.should == empty
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment