Module: HCL

Defined in:
lib/hcl.rb,
lib/hcl/version.rb,
lib/hcl/monkey_patch.rb

Defined Under Namespace

Classes: ASTVisitor, Decoder, Generator, Parser, Parslet

Constant Summary collapse

VERSION =
"0.1.0"

Class Method Summary collapse

Class Method Details

.escape_key(key) ⇒ Object



2
3
4
5
6
7
8
9
# File 'lib/hcl/monkey_patch.rb', line 2

def self.escape_key(key)
  str = key.to_s
  pos = str =~ /[^a-zA-Z0-9_\-]/

  return str if pos.nil?

  str.dump
end

.load(source) ⇒ Object



9
10
11
# File 'lib/hcl.rb', line 9

def self.load(source)
  HCL::Parser.new(source).parse
end

.load_file(path) ⇒ Object



13
14
15
# File 'lib/hcl.rb', line 13

def self.load_file(path)
  HCL::Parser.new(File.read(path)).parse
end