Class: ItaxCode::Omocode
- Inherits:
-
Object
- Object
- ItaxCode::Omocode
- Defined in:
- lib/itax_code/omocode.rb
Instance Attribute Summary collapse
-
#tax_code ⇒ Object
readonly
Returns the value of attribute tax_code.
-
#utils ⇒ Object
readonly
Returns the value of attribute utils.
Instance Method Summary collapse
-
#initialize(tax_code, utils = Utils) ⇒ Omocode
constructor
Creates a new instance for a given tax_code.
-
#omocodes ⇒ Array
Computes the omocodes from a given tax_code by first identifying the original tax_code and then appending all the omocodes.
-
#original_omocode ⇒ String
The original omocode is the one that have all the omocody indexes decoded as number, and from which any of its omocodes are generated.
Constructor Details
Instance Attribute Details
#tax_code ⇒ Object (readonly)
Returns the value of attribute tax_code.
5 6 7 |
# File 'lib/itax_code/omocode.rb', line 5 def tax_code @tax_code end |
#utils ⇒ Object (readonly)
Returns the value of attribute utils.
5 6 7 |
# File 'lib/itax_code/omocode.rb', line 5 def utils @utils end |
Instance Method Details
#omocodes ⇒ Array
Computes the omocodes from a given tax_code by first identifying the original tax_code and then appending all the omocodes.
20 21 22 23 24 |
# File 'lib/itax_code/omocode.rb', line 20 def omocodes [original_omocode] + utils.omocodia_indexes_combos.map do |combo| omocode(original_omocode, combo, ->(char) { utils.omocodia_encode(char) }) end end |
#original_omocode ⇒ String
The original omocode is the one that have all the omocody indexes decoded as number, and from which any of its omocodes are generated.
30 31 32 33 34 |
# File 'lib/itax_code/omocode.rb', line 30 def original_omocode @original_omocode ||= omocode( tax_code, utils.omocodia_indexes, ->(char) { utils.omocodia_decode(char) } ) end |