Sha256: 7918a5e13614185b9a3eb3b01725ef3894bfeaacc8a44d332f9b2267e7bf3ee3
Contents?: true
Size: 897 Bytes
Versions: 16
Compression:
Stored size: 897 Bytes
Contents
require 'jsduck/util/json' module JsDuck module Options # Handles reading JSON config file, specified by --config option. class Config # Reads JSON configuration from file and returns an array of # config options that can be feeded into optparser. def self.read(filename) config = [] json = Util::Json.read(filename) json.each_pair do |key, value| if key == "--" # filenames config += Array(value).map(&:to_s) elsif value == true # simple switch config += [key.to_s] else # An option with value or with multiple values. # In the latter case, add the option multiple times. Array(value).each do |v| config += [key.to_s, v.to_s] end end end config end end end end
Version data entries
16 entries across 16 versions & 3 rubygems