Sha256: 00016798b7fa1371e25fc0d8c870079848c4a952138abc597bc94e36d1ecf4fb
Contents?: true
Size: 535 Bytes
Versions: 3
Compression:
Stored size: 535 Bytes
Contents
# frozen_string_literal: true require "json" module Spout module Helpers class JsonLoader def self.get_json(file_name, file_type) file = Dir.glob("#{file_type.to_s.downcase}s/**/#{file_name.to_s.downcase}.json", File::FNM_CASEFOLD).first JSON.parse(File.read(file, encoding: "utf-8")) rescue => e puts "JsonLoader Warning".red puts e.to_s.white nil end def self.get_variable(variable_name) get_json(variable_name, "variable") end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
spout-1.0.0 | lib/spout/helpers/json_loader.rb |
spout-1.0.0.beta3 | lib/spout/helpers/json_loader.rb |
spout-1.0.0.beta2 | lib/spout/helpers/json_loader.rb |