RubyMoney/money — pull request #341 by jlecour (2013-11-21 10:30:31+00:00)
Title: Add implicit conversions of Money::Currency

`Currency#to_s` is useful when you want to make an explicit conversion of a currency to a `String`.

Adding `#to_str` and `#to_sym` allows to make implicit conversions to `String` or `Symbol`.

The idea behind implicit vs. explicit conversions in Ruby is well explained by @avdi in his book Confident Ruby.
I hope I've not misunderstood the fundamental idea.

Here is a client code example :

```ruby
def allowed_currency?(currency)
currency = currency.to_str if currency.respond_to?(:to_str)
currency = String(currency)

%w(EUR USD GBP).include?(currency)
end

cur = Money::Currency.new(:EUR)
allowed_currency?(cur)
```

With that you can be sure that you test with a valid string.

* if the input is a string, it's OK
* if the input respond to `#to_str`, it is converted and the `Kernel.String` conversion function is useless
* if it doesn't respond to `#to_str`, then `Kernel.String` makes its best to produce a String of fails if it can't

In this exact case, we might want to return `false` if the input can't be converted to a String, but you get the idea.