class ConfigHound::Parser

Public Class Methods

parse(*args) click to toggle source
# File lib/config_hound/parser.rb, line 5
def self.parse(*args)
  new.parse(*args)
end

Public Instance Methods

parse(raw, format) click to toggle source
# File lib/config_hound/parser.rb, line 9
def parse(raw, format)
  parse_method = "parse_#{format}"
  raise "unknown format: #{format}" unless respond_to?(parse_method, true)
  send(parse_method, raw)
end

Protected Instance Methods

parse_json(raw) click to toggle source
# File lib/config_hound/parser.rb, line 24
def parse_json(raw)
  require "multi_json"
  MultiJson.load(raw)
end
parse_toml(raw) click to toggle source
# File lib/config_hound/parser.rb, line 29
def parse_toml(raw)
  require "toml"
  TOML.load(raw)
end
parse_yaml(raw) click to toggle source
# File lib/config_hound/parser.rb, line 17
def parse_yaml(raw)
  require "yaml"
  YAML.safe_load(raw, [], [], true)
end
Also aliased as: parse_yml
parse_yml(raw)
Alias for: parse_yaml