Class: Rough::ResolvedOptions
- Inherits:
-
Object
- Object
- Rough::ResolvedOptions
- Defined in:
- lib/rough/options.rb
Overview
Resolved options with all defaults filled in. Behaves like a read-only hash-like object.
Constant Summary collapse
- FIELDS =
DEFAULTS.keys + [:randomizer]
Instance Method Summary collapse
-
#initialize(**overrides) ⇒ ResolvedOptions
constructor
A new instance of ResolvedOptions.
- #merge(**overrides) ⇒ Object
Constructor Details
#initialize(**overrides) ⇒ ResolvedOptions
Returns a new instance of ResolvedOptions.
43 44 45 46 |
# File 'lib/rough/options.rb', line 43 def initialize(**overrides) DEFAULTS.each { |k, v| send(:"#{k}=", v) } overrides.each { |k, v| send(:"#{k}=", v) } end |
Instance Method Details
#merge(**overrides) ⇒ Object
48 49 50 51 52 |
# File 'lib/rough/options.rb', line 48 def merge(**overrides) dup.tap do |o| overrides.each { |k, v| o.send(:"#{k}=", v) } end end |