Class: NumbersAndWords::Strategies::FiguresConverter::Languages::Base

Inherits:
Object
  • Object
show all
Includes:
Families::Base
Defined in:
lib/numbers_and_words/strategies/figures_converter/languages/base.rb

Direct Known Subclasses

PtBr

Instance Attribute Summary collapse

Attributes included from Families::Base

#current_capacity, #parent_figures

Instance Method Summary collapse

Methods included from Families::Base

#capacity_iteration, #complex_number_to_words, #complex_tens, #hundreds_number_to_words, #save_parent_figures, #simple_number_to_words, #strings_logic, #words_in_capacity

Methods included from Families::Helpers

#megs, #translate, #zero

Constructor Details

#initialize(strategy) ⇒ Base

Returns a new instance of Base.



12
13
14
15
16
17
# File 'lib/numbers_and_words/strategies/figures_converter/languages/base.rb', line 12

def initialize(strategy)
  @strategy = strategy
  @figures = strategy.figures
  @translations = strategy.translations
  @options = strategy.options
end

Instance Attribute Details

#figuresObject

Returns the value of attribute figures.



10
11
12
# File 'lib/numbers_and_words/strategies/figures_converter/languages/base.rb', line 10

def figures
  @figures
end

#optionsObject

Returns the value of attribute options.



10
11
12
# File 'lib/numbers_and_words/strategies/figures_converter/languages/base.rb', line 10

def options
  @options
end

#strategyObject

Returns the value of attribute strategy.



10
11
12
# File 'lib/numbers_and_words/strategies/figures_converter/languages/base.rb', line 10

def strategy
  @strategy
end

#stringsObject

Returns the value of attribute strings.



10
11
12
# File 'lib/numbers_and_words/strategies/figures_converter/languages/base.rb', line 10

def strings
  @strings
end

#translationsObject

Returns the value of attribute translations.



10
11
12
# File 'lib/numbers_and_words/strategies/figures_converter/languages/base.rb', line 10

def translations
  @translations
end

Instance Method Details



24
25
26
# File 'lib/numbers_and_words/strategies/figures_converter/languages/base.rb', line 24

def print_words
  @strings.reverse.join(' ')
end

#wordsObject



19
20
21
22
# File 'lib/numbers_and_words/strategies/figures_converter/languages/base.rb', line 19

def words
  @strings = strings_logic
  @strings.empty? && zero || print_words
end