Sha256: 1117f95793b41d31092f57ddf06b7750f1885c8c906738c33adbb3fa696b3aba
Contents?: true
Size: 824 Bytes
Versions: 3
Compression:
Stored size: 824 Bytes
Contents
require 'multi_json' require 'yaml' require 'nugrant/bag' module Nugrant module Helper module Bag def self.read(filepath, filetype, config) Nugrant::Bag.new(parse_data(filepath, filetype, config), config) end def self.restricted_keys() Nugrant::Bag.instance_methods() end private def self.parse_data(filepath, filetype, config) return if not File.exists?(filepath) File.open(filepath, "rb") do |file| return send("parse_#{filetype}", file) end rescue => error config.parse_error.call(filepath, error) end def self.parse_json(io) MultiJson.load(io.read()) end def self.parse_yaml(io) YAML.load(io.read()) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
nugrant-2.1.3 | lib/nugrant/helper/bag.rb |
nugrant-2.1.2 | lib/nugrant/helper/bag.rb |
nugrant-2.1.1 | lib/nugrant/helper/bag.rb |