Skip to content

Commit

Permalink
[Oops] restore the << alias for Config::merge!
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiopelosin committed May 27, 2012
1 parent ea81ad7 commit f06a5de
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/xcodeproj/config.rb
Expand Up @@ -49,6 +49,7 @@ def includes
def merge!(xcconfig)
@attributes.merge!(xcconfig.to_hash) { |key, v1, v2| "#{v1} #{v2}" }
end
alias_method :<<, :merge!

def merge(config)
self.dup.tap { |x|x.merge!(config) }
Expand Down
8 changes: 8 additions & 0 deletions spec/config_spec.rb
Expand Up @@ -50,6 +50,14 @@
}
end

it "merges another config hash in place with the `<<` shortcut" do
@config << { 'HEADER_SEARCH_PATHS' => '/some/path' }
@config.should == {
'OTHER_LD_FLAGS' => '-framework Foundation',
'HEADER_SEARCH_PATHS' => '/some/path'
}
end

it "merges another hash in a new one" do
new = @config.merge('HEADER_SEARCH_PATHS' => '/some/path')
new.object_id.should.not == @config.object_id
Expand Down

0 comments on commit f06a5de

Please sign in to comment.