class JsDuck::Options::Config
Handles reading JSON config file, specified by –config option.
Public Class Methods
read(filename)
click to toggle source
Reads JSON configuration from file and returns an array of config options that can be feeded into optparser.
# File lib/jsduck/options/config.rb, line 11 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