Skip to content

Commit

Permalink
[Metadata] Use hash with indifferent access
Browse files Browse the repository at this point in the history
  • Loading branch information
segiddins committed Apr 7, 2016
1 parent 644ff24 commit b6df430
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/cocoapods-core/source/metadata.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
autoload :Digest, 'digest/md5'
require 'active_support/hash_with_indifferent_access'
require 'active_support/core_ext/hash/indifferent_access'

module Pod
class Source
Expand All @@ -10,6 +12,7 @@ class Metadata
attr_reader :last_compatible_versions

def initialize(hash = {})
hash = hash.with_indifferent_access
@minimum_cocoapods_version = hash['min']
@minimum_cocoapods_version &&= Pod::Version.new(@minimum_cocoapods_version)
@maximum_cocoapods_version = hash['max']
Expand All @@ -26,7 +29,7 @@ def self.from_file(file)
end

def to_hash
hash = {}
hash = ActiveSupport::HashWithIndifferentAccess.new
hash['min'] = @minimum_cocoapods_version.to_s if @minimum_cocoapods_version
hash['max'] = @maximum_cocoapods_version.to_s if @maximum_cocoapods_version
hash['last'] = @latest_cocoapods_version.to_s if @latest_cocoapods_version
Expand Down

0 comments on commit b6df430

Please sign in to comment.