Class: Canon::Config::FormatConfig
- Inherits:
-
Object
- Object
- Canon::Config::FormatConfig
- Defined in:
- lib/canon/config.rb
Overview
Format-specific configuration Each format (XML, HTML, JSON, YAML) has its own instance
Instance Attribute Summary collapse
-
#diff ⇒ Object
readonly
Returns the value of attribute diff.
-
#format ⇒ Object
readonly
Returns the value of attribute format.
-
#match ⇒ Object
readonly
Returns the value of attribute match.
Instance Method Summary collapse
- #apply_profile_data(data) ⇒ Object
- #clear_profile! ⇒ Object
-
#initialize(format) ⇒ FormatConfig
constructor
A new instance of FormatConfig.
- #preprocessing ⇒ Object
- #preprocessing=(value) ⇒ Object
- #reset! ⇒ Object
Constructor Details
#initialize(format) ⇒ FormatConfig
Returns a new instance of FormatConfig.
129 130 131 132 133 134 135 |
# File 'lib/canon/config.rb', line 129 def initialize(format) @format = format @match = MatchConfig.new(format) @diff = DiffConfig.new(format) @preprocessing = nil @profile_preprocessing = nil end |
Instance Attribute Details
#diff ⇒ Object (readonly)
Returns the value of attribute diff.
127 128 129 |
# File 'lib/canon/config.rb', line 127 def diff @diff end |
#format ⇒ Object (readonly)
Returns the value of attribute format.
127 128 129 |
# File 'lib/canon/config.rb', line 127 def format @format end |
#match ⇒ Object (readonly)
Returns the value of attribute match.
127 128 129 |
# File 'lib/canon/config.rb', line 127 def match @match end |
Instance Method Details
#apply_profile_data(data) ⇒ Object
152 153 154 155 156 157 158 159 160 |
# File 'lib/canon/config.rb', line 152 def apply_profile_data(data) if data.key?("preprocessing") val = data["preprocessing"] @profile_preprocessing = val.is_a?(String) ? val.to_sym : val end @match.apply_profile_data(data["match"]) if data.key?("match") @diff.apply_profile_data(data["diff"]) if data.key?("diff") end |
#clear_profile! ⇒ Object
162 163 164 165 166 |
# File 'lib/canon/config.rb', line 162 def clear_profile! @profile_preprocessing = nil @match.clear_profile! @diff.clear_profile! end |
#preprocessing ⇒ Object
137 138 139 |
# File 'lib/canon/config.rb', line 137 def preprocessing @preprocessing || @profile_preprocessing end |
#preprocessing=(value) ⇒ Object
141 142 143 |
# File 'lib/canon/config.rb', line 141 def preprocessing=(value) @preprocessing = value end |
#reset! ⇒ Object
145 146 147 148 149 150 |
# File 'lib/canon/config.rb', line 145 def reset! @match.reset! @diff.reset! @preprocessing = nil @profile_preprocessing = nil end |