Class: Koota::FileParser

Inherits:
Object
  • Object
show all
Defined in:
lib/koota/file_parser.rb

Overview

This class parses .koota input files; mainly used by CLI.

Defined Under Namespace

Classes: Error

Instance Method Summary collapse

Instance Method Details

#call(input) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/koota/file_parser.rb', line 11

def call(input)
  refs = {}
  root = process_input(input) do |subpat_key, subpat_value|
    subpat_refs = find_refs(subpat_value, refs)
    refs[subpat_key] = Koota::Pattern.new(subpat_value, subpat_refs)
  end

  Koota::Pattern.new(root, find_refs(root, refs))
end