Class: Canon::Config::MatchConfig
- Inherits:
-
Object
- Object
- Canon::Config::MatchConfig
- Defined in:
- lib/canon/config.rb
Overview
Match configuration for comparison behavior
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(format = nil) ⇒ MatchConfig
constructor
A new instance of MatchConfig.
-
#profile ⇒ Object
Profile accessor with ENV override support.
- #profile=(value) ⇒ Object
- #reset! ⇒ Object
-
#to_h ⇒ Object
Build match options from profile and options.
Constructor Details
#initialize(format = nil) ⇒ MatchConfig
Returns a new instance of MatchConfig.
115 116 117 118 119 |
# File 'lib/canon/config.rb', line 115 def initialize(format = nil) @format = format @resolver = build_resolver(format) @options = {} end |
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
113 114 115 |
# File 'lib/canon/config.rb', line 113 def @options end |
Instance Method Details
#profile ⇒ Object
Profile accessor with ENV override support
131 132 133 |
# File 'lib/canon/config.rb', line 131 def profile @resolver.resolve(:profile) end |
#profile=(value) ⇒ Object
135 136 137 |
# File 'lib/canon/config.rb', line 135 def profile=(value) @resolver.set_programmatic(:profile, value) end |
#reset! ⇒ Object
125 126 127 128 |
# File 'lib/canon/config.rb', line 125 def reset! @resolver = build_resolver(@format) @options = {} end |
#to_h ⇒ Object
Build match options from profile and options
140 141 142 143 144 145 |
# File 'lib/canon/config.rb', line 140 def to_h result = {} result[:match_profile] = profile if profile result[:match] = @options if @options && !@options.empty? result end |