Class: Elm::Options
- Inherits:
-
Object
- Object
- Elm::Options
- Includes:
- Contracts::Builtin, Contracts::Core
- Defined in:
- lib/elm/options.rb
Overview
Options to run elm
Constant Summary collapse
- FORMATS =
[:normal, :json].freeze
Instance Attribute Summary collapse
-
#docs ⇒ Object
Returns the value of attribute docs.
-
#output ⇒ Object
Returns the value of attribute output.
-
#report ⇒ Object
Returns the value of attribute report.
-
#warn ⇒ Object
Returns the value of attribute warn.
-
#yes ⇒ Object
Returns the value of attribute yes.
Class Method Summary collapse
- .clone(opts) ⇒ Object
- .with(output: 'index.html', yes: false, report: :normal, warn: false, docs: nil) ⇒ Object
Instance Method Summary collapse
-
#initialize ⇒ Options
constructor
A new instance of Options.
- #to_a ⇒ Object
- #with_docs(docs) ⇒ Object
- #with_output(output) ⇒ Object
- #with_report(report) ⇒ Object
- #with_warn ⇒ Object
- #with_yes ⇒ Object
Constructor Details
#initialize ⇒ Options
Returns a new instance of Options.
44 45 46 47 48 49 50 51 52 |
# File 'lib/elm/options.rb', line 44 def initialize @output = 'index.html' @yes = false @report = :normal @warn = false @docs = nil self end |
Instance Attribute Details
#docs ⇒ Object
Returns the value of attribute docs.
41 42 43 |
# File 'lib/elm/options.rb', line 41 def docs @docs end |
#output ⇒ Object
Returns the value of attribute output.
41 42 43 |
# File 'lib/elm/options.rb', line 41 def output @output end |
#report ⇒ Object
Returns the value of attribute report.
41 42 43 |
# File 'lib/elm/options.rb', line 41 def report @report end |
#warn ⇒ Object
Returns the value of attribute warn.
41 42 43 |
# File 'lib/elm/options.rb', line 41 def warn @warn end |
#yes ⇒ Object
Returns the value of attribute yes.
41 42 43 |
# File 'lib/elm/options.rb', line 41 def yes @yes end |
Class Method Details
.clone(opts) ⇒ Object
31 32 33 34 35 36 37 |
# 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 |
.with(output: 'index.html', yes: false, report: :normal, warn: false, docs: nil) ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# 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 |
Instance Method Details
#to_a ⇒ Object
86 87 88 89 90 91 92 93 94 |
# 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 |
#with_docs(docs) ⇒ Object
125 126 127 128 129 |
# File 'lib/elm/options.rb', line 125 def with_docs(docs) opts = Options.clone self opts.docs = docs opts end |
#with_output(output) ⇒ Object
97 98 99 100 101 |
# File 'lib/elm/options.rb', line 97 def with_output(output) opts = Options.clone self opts.output = output opts end |
#with_report(report) ⇒ Object
111 112 113 114 115 |
# File 'lib/elm/options.rb', line 111 def with_report(report) opts = Options.clone self opts.report = report opts end |