Skip to content

Commit

Permalink
fixing broken attribute tags in documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
george-carlin committed Feb 1, 2015
1 parent b222c77 commit 5d5cef6
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 53 deletions.
61 changes: 37 additions & 24 deletions lib/money/currency.rb
Expand Up @@ -141,7 +141,7 @@ def register(curr)

# Unregister a currency.
#
# @param [Object] A Hash with the key `:iso_code`, or the ISO code
# @param [Object] curr 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
Expand All @@ -164,29 +164,42 @@ def stringify_keys
end
end

# @attr_reader [Symbol] id The symbol used to identify the currency,
# usually the lowercase +iso_code+ attribute.
# @attr_reader [Integer] priority A numerical value you can use to
# sort/group the currency list.
# @attr_reader [String] iso_code The international 3-letter code as defined
# by the ISO 4217 standard.
# @attr_reader [String] iso_numeric The international 3-numeric code as
# defined by the ISO 4217 standard.
# @attr_reader [String] name The currency name.
# @attr_reader [String] symbol The currency symbol (UTF-8 encoded).
# @attr_reader [String] disambiguate_symbol Alternative currency used if symbol is ambiguous
# @attr_reader [String] html_entity The html entity for the currency symbol
# @attr_reader [String] subunit The name of the fractional monetary unit.
# @attr_reader [Integer] subunit_to_unit The proportion between the unit
# and the subunit
# @attr_reader [String] decimal_mark The decimal mark, or character used to
# separate the whole unit from the subunit.
# @attr_reader [String] The character used to separate thousands grouping
# of the whole unit.
# @attr_reader [Boolean] symbol_first Should the currency symbol precede
# the amount, or should it come after?
# @attr_reader [Integer] smallest_denomination Smallest amount of cash
# possible (in the subunit of this currency)
# @!attribute [r] id
# @return [Symbol] The symbol used to identify the currency, usually THE
# lowercase +iso_code+ attribute.
# @!attribute [r] priority
# @return [Integer] A numerical value you can use to sort/group the
# currency list.
# @!attribute [r] iso_code
# @return [String] The international 3-letter code as defined by the ISO
# 4217 standard.
# @!attribute [r] iso_numeric
# @return [String] The international 3-numeric code as defined by the ISO
# 4217 standard.
# @!attribute [r] name
# @return [String] The currency name.
# @!attribute [r] symbol
# @return [String] The currency symbol (UTF-8 encoded).
# @!attribute [r] disambiguate_symbol
# @return [String] Alternative currency used if symbol is ambiguous
# @!attribute [r] html_entity
# @return [String] The html entity for the currency symbol
# @!attribute [r] subunit
# @return [String] The name of the fractional monetary unit.
# @!attribute [r] subunit_to_unit
# @return [Integer] The proportion between the unit and the subunit
# @!attribute [r] decimal_mark
# @return [String] The decimal mark, or character used to separate the
# whole unit from the subunit.
# @!attribute [r] The
# @return [String] character used to separate thousands grouping of the
# whole unit.
# @!attribute [r] symbol_first
# @return [Boolean] Should the currency symbol precede the amount, or
# should it come after?
# @!attribute [r] smallest_denomination
# @return [Integer] Smallest amount of cash possible (in the subunit of
# this currency)

attr_reader :id, :priority, :iso_code, :iso_numeric, :name, :symbol,
:disambiguate_symbol, :html_entity, :subunit, :subunit_to_unit, :decimal_mark,
Expand Down
70 changes: 41 additions & 29 deletions lib/money/money.rb
Expand Up @@ -76,44 +76,53 @@ def round_to_nearest_cash_value
return_value(rounded_value)
end

# @attr_reader [Currency] currency The currency the money is in.
# @attr_reader [Money::Bank::*] bank The +Money::Bank+ based object used to
# perform currency exchanges with.
# @!attribute [r] currency
# @return [Currency] The money's currency.
# @!attribute [r] bank
# @return [Money::Bank::Base] The +Money::Bank+-based object which currency
# exchanges are performed with.

attr_reader :currency, :bank

# Class Methods
class << self
# @attr_accessor [Money::Bank::*] default_bank Each Money object is
# associated to a bank object, which is responsible for currency exchange.
# This property allows you to specify the default bank object. The default
# value for this property is an instance of +Bank::VariableExchange.+ It
# allows one to specify custom exchange rates.

# @!attribute [rw] default_bank
# @return [Money::Bank::Base] Each Money object is associated to a bank
# object, which is responsible for currency exchange. This property
# allows you to specify the default bank object. The default value for
# this property is an instance of +Bank::VariableExchange.+ It allows
# one to specify custom exchange rates.
#
# @attr_accessor [Money::Currency] default_currency The default currency,
# which is used when +Money.new+ is called without an explicit currency
# argument. The default value is Currency.new("USD"). The value must be a
# valid +Money::Currency+ instance.
# @!attribute default_currency
# @return [Money::Currency] The default currency, which is used when
# +Money.new+ is called without an explicit currency argument. The
# default value is Currency.new("USD"). The value must be a valid
# +Money::Currency+ instance.
#
# @attr_accessor [Hash] default_formatting_rules Use this to define a default
# hash of rules for everytime +Money#format+ is called.
# Rules provided on method call will be merged with the default ones.
# To overwrite a rule, just provide the intended value while calling +format+.
# @!attribute default_formatting_rules
# @return [Hash] Use this to define a default hash of rules for everytime
# +Money#format+ is called. Rules provided on method call will be
# merged with the default ones. To overwrite a rule, just provide the
# intended value while calling +format+.
#
# @see +Money::Formatting#format+ for more details.
# @see +Money::Formatting#format+ for more details.
#
# @example
# Money.default_formatting_rules = { :display_free => true }
# Money.new(0, "USD").format # => "free"
# Money.new(0, "USD").format(:display_free => false) # => "$0.00"
# @example
# Money.default_formatting_rules = { :display_free => true }
# Money.new(0, "USD").format # => "free"
# Money.new(0, "USD").format(:display_free => false) # => "$0.00"
#
# @attr_accessor [true, false] use_i18n Use this to disable i18n even if
# it's used by other objects in your app.
# @!attribute [rw] use_i18n
# @return [Boolean] Use this to disable i18n even if it's used by other
# objects in your app.
#
# @attr_accessor [true, false] infinite_precision Use this to enable
# infinite precision cents
# @!attribute [rw] infinite_precision
# @return [Boolean] Use this to enable infinite precision cents
#
# @attr_accessor [Integer] conversion_precision Use this to specify
# precision for converting Rational to BigDecimal
# @!attribute [rw] conversion_precision
# @return [Fixnum] Use this to specify precision for converting Rational
# to BigDecimal
attr_accessor :default_bank, :default_currency, :default_formatting_rules,
:use_i18n, :infinite_precision, :conversion_precision

Expand Down Expand Up @@ -160,7 +169,7 @@ def self.inherited(base)
# rounding mode and a block to temporatly change it. It will
# then return the results of the block instead.
#
# @param [BigDecimal::ROUND_MODE] optional
# @param [BigDecimal::ROUND_MODE] mode
#
# @return [BigDecimal::ROUND_MODE,Yield] rounding mode or block results
#
Expand Down Expand Up @@ -208,7 +217,10 @@ def self.disallow_currency_conversion!
# Alternatively you can use the convenience
# methods like {Money.ca_dollar} and {Money.us_dollar}.
#
# @param [Numeric] fractional The value given in the fractional unit.
# @param [Object] obj Either The fractional value of the money,
# a Money object, or a currency. (If passed a currency as the first
# argument, a Money will be created in that currency with fractional value
# = 0.
# @param [Currency, String, Symbol] currency The currency format.
# @param [Money::Bank::*] bank The exchange bank to use.
#
Expand Down

0 comments on commit 5d5cef6

Please sign in to comment.