Class: Configgy::ConfigParser

Inherits:
Treetop_ConfiggyParser show all
Defined in:
lib/configgy/config_parser.rb

Instance Method Summary collapse

Methods included from Treetop_Configgy

#_nt_assignment, #_nt_declaration, #_nt_hex_digit, #_nt_identifier, #_nt_identifier_token, #_nt_include_file, #_nt_number, #_nt_quoted_entity, #_nt_root, #_nt_section, #_nt_string, #_nt_string_innards, #_nt_string_list, #_nt_tag_attribute, #_nt_toggle, #_nt_true_false, #_nt_value, #_nt_whitespace, #root

Instance Method Details

#import_file(filename) ⇒ Object



3
4
5
# File 'lib/configgy/config_parser.rb', line 3

def import_file(filename)
  File.open(filename, "r").read
end

#load_file(filename, map = nil) ⇒ Object



16
17
18
# File 'lib/configgy/config_parser.rb', line 16

def load_file(filename, map=nil)
  read(import_file(filename), map)
end

#read(s, map = nil) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/configgy/config_parser.rb', line 7

def read(s, map=nil)
  if !map
    map = Configgy::ConfigMap.new(nil, "")
    map.root = map
  end
  parse(s).apply(map, self)
  map
end