Skip to content

Commit

Permalink
Update (#112)
Browse files Browse the repository at this point in the history
- Fix README 4167 -> 4217
- Add methods
  • Loading branch information
EricForgy authored Jun 25, 2020
1 parent faa47a7 commit 997ff11
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name = "Currencies"
uuid = "0fd90b74-7c1f-579e-9252-02cd883047b9"
license = "MIT"
authors = ["Eric Forgy <Eric.Forgy@cavalre.com>", "ScottPJones <scottjones@alum.mit.edu>"]
version = "0.15.0"
version = "0.15.1"

[deps]
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

This is a core package for the JuliaFinance ecosytem.

It provides bare singleton types based on the standard ISO 4167 3-character alpha codes to be used primarily for dispatch in other JuliaFinance packages together with five methods:
It provides bare singleton types based on the standard ISO 4217 3-character alpha codes to be used primarily for dispatch in other JuliaFinance packages together with five methods:

- `symbol`: The 3-character symbol of the currency.
- `currency`: The singleton type instance for a particular currency symbol
Expand Down Expand Up @@ -92,7 +92,7 @@ Code: 368
Minor Unit: 3
```

If all you need is a list of currencies with names, ISO 4167 codes and minor units, e.g. for building a dropdown menu in a user interface, then this lightweight package is what you want.
If all you need is a list of currencies with names, ISO 4217 codes and minor units, e.g. for building a dropdown menu in a user interface, then this lightweight package is what you want.

## [Assets.jl](https://github.com/JuliaFinance/Assets.jl)

Expand Down
9 changes: 8 additions & 1 deletion src/Currencies.jl
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,19 @@ Returns the ISO 4217 name associated with this value
"""
function name end

symbol(::Currency{S}) where {S} = S
currency(S::Symbol) = _currency_data[S][1]
unit(S::Symbol) = _currency_data[S][2]
code(S::Symbol) = _currency_data[S][3]
name(S::Symbol) = _currency_data[S][4]

symbol(::Type{Currency{S}}) where {S} = S
currency(::Type{Currency{S}}) where {S} = currency(S)
unit(::Type{Currency{S}}) where {S} = unit(S)
code(::Type{Currency{S}}) where {S} = code(S)
name(::Type{Currency{S}}) where {S} = name(S)

symbol(::Currency{S}) where {S} = S
currency(c::Currency) = c
unit(::Currency{S}) where {S} = unit(S)
code(::Currency{S}) where {S} = code(S)
name(::Currency{S}) where {S} = name(S)
Expand Down

0 comments on commit 997ff11

Please sign in to comment.