Skip to content

Commit

Permalink
better documentation for Currency#stringified_keys and
Browse files Browse the repository at this point in the history
#unregister
  • Loading branch information
george-carlin committed Feb 1, 2015
1 parent a137346 commit b222c77
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion lib/money/currency.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,12 @@ def all
table.keys.map {|curr| Currency.new(curr)}.sort_by(&:priority)
end

# We need a string-based validator before creating an unbounded number of symbols.
# We need a string-based validator before creating an unbounded number of
# symbols.
# http://www.randomhacks.net/articles/2007/01/20/13-ways-of-looking-at-a-ruby-symbol#11
# https://github.com/RubyMoney/money/issues/132
#
# @return [Set]
def stringified_keys
@stringified_keys ||= stringify_keys
end
Expand Down Expand Up @@ -135,6 +138,14 @@ def register(curr)
@stringified_keys = stringify_keys
end


# Unregister a currency.
#
# @param [Object] A Hash with the key `:iso_code`, or the ISO code
# as a String or Symbol.
#
# @return [Boolean] true if the currency previously existed, false
# if it didn't.
def unregister(curr)
if curr.is_a?(Hash)
key = curr.fetch(:iso_code).downcase.to_sym
Expand Down

0 comments on commit b222c77

Please sign in to comment.