Options no longer needs deep-copy semantics

Follow-up to 23d90a6a187a57fbdf4eeac146993e3b37c3d4d9.
This commit is contained in:
Jack Nagel 2014-08-20 19:05:49 -05:00
parent 023f02b90a
commit af3d551de7
2 changed files with 0 additions and 14 deletions

View File

@ -50,9 +50,6 @@ end
class Options class Options
include Enumerable include Enumerable
attr_reader :options
protected :options
def self.create(array) def self.create(array)
options = new options = new
array.each do |e| array.each do |e|
@ -70,11 +67,6 @@ class Options
@options = Set.new(*args) @options = Set.new(*args)
end end
def initialize_copy(other)
super
@options = other.options.dup
end
def each(*args, &block) def each(*args, &block)
@options.each(*args, &block) @options.each(*args, &block)
end end

View File

@ -125,10 +125,4 @@ class OptionsTests < Homebrew::TestCase
debug = Option.new("-d") debug = Option.new("-d")
assert_equal [verbose, debug].sort, Options.create(array).sort assert_equal [verbose, debug].sort, Options.create(array).sort
end end
def test_copies_do_not_share_underlying_collection
copy = @options.dup << Option.new("foo")
assert_empty @options
assert_equal 1, copy.count
end
end end