Class: AqBanking::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/aq_banking/parser.rb

Instance Method Summary collapse

Instance Method Details

#parse_account_list(block_str) ⇒ AqBanking::Parsed::Account

Parameters:

  • block_str (String)

Returns:



10
11
12
13
14
15
# File 'lib/aq_banking/parser.rb', line 10

def (block_str)
  tree = parse_block block_str
  tree.blocks.map do ||
    AqBanking::Parsed::Account.new 
  end
end

#parse_block(block_str) ⇒ Object

Returns [].

Parameters:

  • block_str (String)

Returns:



19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/aq_banking/parser.rb', line 19

def parse_block(block_str)
  parser = AccountInfoListParser.new
  tree = parser.parse(block_str)

  # If the AST is nil then there was an error during parsing
  # we need to report a simple error message to help the user
  if tree.nil?
    raise Errors::ParsingError.new(block_str, parser), parser.failure_reason
  end

  tree
end