Class: Confmake::BashParser

Inherits:
Object
  • Object
show all
Defined in:
lib/confmake/bash_parser.rb

Class Method Summary collapse

Class Method Details

.parse(text) ⇒ Object



13
14
15
16
17
18
# File 'lib/confmake/bash_parser.rb', line 13

def self.parse text
  parsed_text = text
  parsed_text = parse_as_array text if text.start_with? "["
  parsed_text = parse_as_object text if text.start_with? "{"
  parsed_text
end

.parse_user_input(user_input) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/confmake/bash_parser.rb', line 5

def self.parse_user_input user_input
  parsed_input = {}
  user_input.each { |k,v|
    parsed_input[k.to_s] = self.parse v
  }
  parsed_input
end