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

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

#translate

Constructor Details

#initialize(strategy) ⇒ Base

Returns a new instance of Base.



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

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.



8
9
10
# File 'lib/numbers_and_words/strategies/figures_converter/languages/base.rb', line 8

def figures
  @figures
end

#optionsObject

Returns the value of attribute options.



8
9
10
# File 'lib/numbers_and_words/strategies/figures_converter/languages/base.rb', line 8

def options
  @options
end

#strategyObject

Returns the value of attribute strategy.



8
9
10
# File 'lib/numbers_and_words/strategies/figures_converter/languages/base.rb', line 8

def strategy
  @strategy
end

#stringsObject

Returns the value of attribute strings.



8
9
10
# File 'lib/numbers_and_words/strategies/figures_converter/languages/base.rb', line 8

def strings
  @strings
end

#translationsObject

Returns the value of attribute translations.



8
9
10
# File 'lib/numbers_and_words/strategies/figures_converter/languages/base.rb', line 8

def translations
  @translations
end

Instance Method Details



22
23
24
# File 'lib/numbers_and_words/strategies/figures_converter/languages/base.rb', line 22

def print_words
  @strings.reverse.join ' '
end

#wordsObject



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

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