Class: Emendate::Options
- Inherits:
-
Object
- Object
- Emendate::Options
- Defined in:
- lib/emendate/options.rb
Overview
To add or update an option there are several places to edit:
-
Emendate (lib/emendate.rb) – register the options with dry-configurable
-
Emendate::OptionsContract – used to validate configs
-
docs/options.adoc
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(opthash = {}) ⇒ Options
constructor
A new instance of Options.
- #merge(opthash) ⇒ Object
Constructor Details
#initialize(opthash = {}) ⇒ Options
Returns a new instance of Options.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/emendate/options.rb', line 18 def initialize(opthash = {}) return if opthash.empty? @opthash = opthash validation_errs = Emendate::OptionsContract.new .call(**opthash) .errors .to_h if validation_errs.empty? handle_edtf_shortcut if Emendate..edtf handle_collectionspace if Emendate..dialect == :collectionspace if Emendate..dialect == :lyrasis_pseudo_edtf handle_lyrasis_pseudo_edtf end else report_errors_and_exit(validation_errs) end end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
12 13 14 |
# File 'lib/emendate/options.rb', line 12 def @options end |
Class Method Details
.list ⇒ Object
14 15 16 |
# File 'lib/emendate/options.rb', line 14 def self.list Emendate.config..values.each { |opt, val| puts "#{opt}: #{val}" } end |
Instance Method Details
#merge(opthash) ⇒ Object
38 39 40 41 |
# File 'lib/emendate/options.rb', line 38 def merge(opthash) @options = .merge(opthash) verify end |