Class: Keepr::GroupsCreator

Inherits:
Object
  • Object
show all
Defined in:
lib/keepr/groups_creator.rb

Instance Method Summary collapse

Constructor Details

#initialize(target, language = :de) ⇒ GroupsCreator

Returns a new instance of GroupsCreator.

Raises:

  • (ArgumentError)


4
5
6
7
8
9
10
# File 'lib/keepr/groups_creator.rb', line 4

def initialize(target, language = :de)
  raise ArgumentError unless %i[balance profit_and_loss].include?(target)
  raise ArgumentError unless %i[de es en].include?(language)

  @target   = target
  @language = language
end

Instance Method Details

#runObject



12
13
14
15
16
17
18
19
20
# File 'lib/keepr/groups_creator.rb', line 12

def run
  case @target
  when :balance then
    load 'asset.txt', target: :asset
    load 'liability.txt', target: :liability
  when :profit_and_loss
    load 'profit_and_loss.txt', target: :profit_and_loss
  end
end