Skip to content

Commit 09519fc

Browse files
authored
Merge pull request #62 from jakewilliami/fallback-multiple-dispatch
Add generic type fallback for multiple dispatch! v1.2.4
2 parents 1d5ff37 + ef2d98f commit 09519fc

File tree

4 files changed

+17
-3
lines changed

4 files changed

+17
-3
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "SpelledOut"
22
uuid = "4728c690-e668-4265-bc0d-51a8c0f93067"
33
authors = ["Jake W. Ireland <[email protected]> and contributors"]
4-
version = "1.2.3"
4+
version = "1.2.4"
55

66
[deps]
77
DecFP = "55939f99-70c6-5e9b-8bb0-5071ed7d61fd"

src/es.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ function es_spell_large(_number)
9292
end
9393

9494

95-
function spelled_out_es(number; dict=:standard)
95+
function spelled_out_es(number::Union{Integer, Float64}; dict=:standard)
9696
if iszero(number)
9797
return "cero"
9898
end
@@ -135,3 +135,7 @@ end
135135

136136

137137

138+
# Fallback method if we do not know how to handle the input
139+
function spelled_out_es(number, dict = :standard)
140+
throw(error("Cannot parse type $(typeof(number)). Please make an issue."))
141+
end

src/pt.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ function pt_spell_large( _number; portugal::Bool = false )
120120
return res
121121
end
122122

123-
function spelled_out_pt( number; portugal::Bool = false, dict::Symbol = :standard )
123+
function spelled_out_pt( number::Union{Integer, Float64}; portugal::Bool = false, dict::Symbol = :standard )
124124
if iszero( number )
125125
return "zero"
126126
end
@@ -156,3 +156,7 @@ function spelled_out_pt( number; portugal::Bool = false, dict::Symbol = :standar
156156
end
157157

158158

159+
# Fallback method if we do not know how to handle the input
160+
function spelled_out_pt(number; portugal::Bool = false, dict::Symbol = :standard)
161+
throw(error("Cannot parse type $(typeof(number)). Please make an issue."))
162+
end

src/ru.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
function spelled_out_ru(number::Number)
22

3+
4+
end
5+
6+
# Fallback method if we do not know how to handle the input
7+
function spelled_out_ru(number)
8+
throw(error("Cannot parse type $(typeof(number)). Please make an issue."))
39
end

0 commit comments

Comments
 (0)