Skip to content

Commit

Permalink
make an explicit key set so they're all normalized as symbols
Browse files Browse the repository at this point in the history
  • Loading branch information
technoweenie committed Nov 9, 2013
1 parent 6243f16 commit c0b7fd3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/faraday/options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def merge(value)

# Public
def fetch(key, *args)
return send(key) if keys.include?(key)
return send(key) if symbolized_key_set.include?(key.to_sym)

key_setter = "#{key}="

Expand Down Expand Up @@ -130,6 +130,10 @@ def [](key)
end
end

def symbolized_key_set
@symbolized_key_set ||= Set.new(keys.map { |k| k.to_sym })
end

def self.inherited(subclass)
super
subclass.attribute_options.update(attribute_options)
Expand Down

0 comments on commit c0b7fd3

Please sign in to comment.