-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for french float numbers
- Loading branch information
Showing
13 changed files
with
162 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
lib/numbers_and_words/strategies/array_joiner/languages/fr.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module NumbersAndWords | ||
module Strategies | ||
module ArrayJoiner | ||
module Languages | ||
class Fr < Base | ||
end | ||
end | ||
end | ||
end | ||
end |
1 change: 1 addition & 0 deletions
1
lib/numbers_and_words/strategies/figures_converter/decorators.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
lib/numbers_and_words/strategies/figures_converter/decorators/fr.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
require 'numbers_and_words/strategies/figures_converter/decorators/fr/base' | ||
require 'numbers_and_words/strategies/figures_converter/decorators/fr/fractional' | ||
require 'numbers_and_words/strategies/figures_converter/decorators/fr/integral' |
12 changes: 12 additions & 0 deletions
12
lib/numbers_and_words/strategies/figures_converter/decorators/fr/base.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
module NumbersAndWords | ||
module Strategies | ||
module FiguresConverter | ||
module Decorators | ||
module Fr | ||
class Base < Decorators::Base | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
37 changes: 37 additions & 0 deletions
37
lib/numbers_and_words/strategies/figures_converter/decorators/fr/fractional.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
module NumbersAndWords | ||
module Strategies | ||
module FiguresConverter | ||
module Decorators | ||
module Fr | ||
class Fractional < Base | ||
def run | ||
"#{super} #{fraction_significance}" | ||
end | ||
|
||
private | ||
|
||
def fraction_significance | ||
@strategy.translations.micros full_fraction.fraction_capacity, figures.join.to_i | ||
end | ||
|
||
def full_fraction | ||
(0..zero_length).inject(figures.clone) { |result, _el| result.unshift 0 }.to_figures | ||
end | ||
|
||
def figures | ||
@strategy.figures.reverse | ||
end | ||
|
||
def zero_length | ||
fraction_length - figures.length | ||
end | ||
|
||
def fraction_length | ||
@options[:fractional][:length].to_i | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
12 changes: 12 additions & 0 deletions
12
lib/numbers_and_words/strategies/figures_converter/decorators/fr/integral.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
module NumbersAndWords | ||
module Strategies | ||
module FiguresConverter | ||
module Decorators | ||
module Fr | ||
class Integral < Base | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module NumbersAndWords | ||
VERSION = '0.11.0'.freeze | ||
VERSION = '0.11.1'.freeze | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
to_words: | ||
fractional: | ||
0.1: zéro et un dixième | ||
0.7: zéro et sept dixièmes | ||
0.01: zéro et un centième | ||
0.77: zéro et soixante-dix-sept centièmes | ||
0.777: zéro et sept cent soixante-dix-sept millièmes | ||
0.7777: zéro et sept mille sept cent soixante-dix-sept dix-millièmes | ||
0.77777: zéro et soixante-dix-sept mille sept cent soixante-dix-sept cent-millièmes | ||
0.777777: zéro et sept cent soixante-dix-sept mille sept cent soixante-dix-sept millionièmes | ||
0.7777777: zéro et sept millions sept cent soixante-dix-sept mille sept cent soixante-dix-sept dix-millionièmes | ||
0.77777777: zéro et soixante-dix-sept millions sept cent soixante-dix-sept mille sept cent soixante-dix-sept cent-millionièmes | ||
0.777777777: zéro et sept cent soixante-dix-sept millions sept cent soixante-dix-sept mille sept cent soixante-dix-sept milliardièmes | ||
0.2935174315119: zéro et deux billions neuf cent trente-cinq milliards cent soixante-quatorze millions trois cent quinze mille cent dix-neuf dix-billionième | ||
21.77: vingt et un et soixante-dix-sept centièmes | ||
111.999: cent onze et neuf cent quatre-vingt-dix-neuf millièmes | ||
4242.7463: quatre mille deux cent quarante-deux et sept mille quatre cent soixante-trois dix-millièmes |