class Elm::Options
Options
to run elm
Constants
- FORMATS
Attributes
docs[R]
output[R]
report[R]
warn[R]
yes[R]
Public Class Methods
clone(opts)
click to toggle source
# File lib/elm/options.rb, line 31 def self.clone(opts) Options.with(output: opts.output, yes: opts.yes, report: opts.report, warn: opts.warn, docs: opts.docs) end
new()
click to toggle source
# File lib/elm/options.rb, line 44 def initialize @output = 'index.html' @yes = false @report = :normal @warn = false @docs = nil self end
with(output: 'index.html', yes: false, report: :normal, warn: false, docs: nil)
click to toggle source
# File lib/elm/options.rb, line 19 def self.with(output: 'index.html', yes: false, report: :normal, warn: false, docs: nil) opts = Options.new opts.output = output opts.yes = yes opts.report = report opts.warn = warn opts.docs = docs unless docs.nil? opts end
Public Instance Methods
docs=(value)
click to toggle source
# File lib/elm/options.rb, line 80 def docs=(value) @docs = value end
output=(value)
click to toggle source
# File lib/elm/options.rb, line 56 def output=(value) # check output is valid @output = value end
report=(value)
click to toggle source
# File lib/elm/options.rb, line 67 def report=(value) if FORMATS.index(value).nil? raise BadReportFormatError, "'#{value}' is not a valid report format" end @report = value end
to_a()
click to toggle source
# File lib/elm/options.rb, line 86 def to_a res = [] push_output res push_yes res push_report res push_warn res push_docs res res end
warn=(value)
click to toggle source
# File lib/elm/options.rb, line 75 def warn=(value) @warn = value end
with_docs(docs)
click to toggle source
# File lib/elm/options.rb, line 125 def with_docs(docs) opts = Options.clone self opts.docs = docs opts end
with_output(output)
click to toggle source
# File lib/elm/options.rb, line 97 def with_output(output) opts = Options.clone self opts.output = output opts end
with_report(report)
click to toggle source
# File lib/elm/options.rb, line 111 def with_report(report) opts = Options.clone self opts.report = report opts end
with_warn()
click to toggle source
# File lib/elm/options.rb, line 118 def with_warn opts = Options.clone self opts.warn = true opts end
with_yes()
click to toggle source
# File lib/elm/options.rb, line 104 def with_yes opts = Options.clone self opts.yes = true opts end
yes=(value)
click to toggle source
# File lib/elm/options.rb, line 62 def yes=(value) @yes = value end
Private Instance Methods
push_docs(res)
click to toggle source
# File lib/elm/options.rb, line 154 def push_docs(res) res << '--docs' && res << @docs unless @docs.nil? end
push_output(res)
click to toggle source
# File lib/elm/options.rb, line 134 def push_output(res) res << '--output' && res << @output unless @output == 'index.html' end
push_report(res)
click to toggle source
# File lib/elm/options.rb, line 144 def push_report(res) res << '--report' && res << @report.to_s unless @report == :normal end
push_warn(res)
click to toggle source
# File lib/elm/options.rb, line 149 def push_warn(res) res << '--warn' if @warn end
push_yes(res)
click to toggle source
# File lib/elm/options.rb, line 139 def push_yes(res) res << '--yes' if @yes end