Class: Canon::Config
- Inherits:
-
Object
- Object
- Canon::Config
- Defined in:
- lib/canon/config.rb,
lib/canon/config/env_schema.rb,
lib/canon/config/env_provider.rb,
lib/canon/config/type_converter.rb,
lib/canon/config/override_resolver.rb
Overview
Global configuration for Canon Provides unified configuration across CLI, Ruby API, and RSpec interfaces
Defined Under Namespace
Classes: DiffConfig, EnvProvider, EnvSchema, FormatConfig, MatchConfig, OverrideResolver, TypeConverter
Instance Attribute Summary collapse
-
#html ⇒ Object
readonly
Returns the value of attribute html.
-
#json ⇒ Object
readonly
Returns the value of attribute json.
-
#string ⇒ Object
readonly
Returns the value of attribute string.
-
#xml ⇒ Object
readonly
Returns the value of attribute xml.
-
#yaml ⇒ Object
readonly
Returns the value of attribute yaml.
Class Method Summary collapse
- .configure {|instance| ... } ⇒ Object
- .instance ⇒ Object
-
.method_missing(method) ⇒ Object
Delegate to instance.
- .reset! ⇒ Object
- .respond_to_missing?(method, include_private = false) ⇒ Boolean
Instance Method Summary collapse
-
#diff_mode ⇒ Object
Backward compatibility methods for top-level diff configuration These delegate to XML diff config for backward compatibility.
- #diff_mode=(value) ⇒ Object
- #html_match_profile ⇒ Object
- #html_match_profile=(value) ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #reset! ⇒ Object
- #use_color ⇒ Object
- #use_color=(value) ⇒ Object
-
#xml_match_profile ⇒ Object
Backward compatibility methods for match profile configuration.
- #xml_match_profile=(value) ⇒ Object
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
40 41 42 43 44 45 46 |
# File 'lib/canon/config.rb', line 40 def initialize @xml = FormatConfig.new(:xml) @html = FormatConfig.new(:html) @json = FormatConfig.new(:json) @yaml = FormatConfig.new(:yaml) @string = FormatConfig.new(:string) end |
Instance Attribute Details
#html ⇒ Object (readonly)
Returns the value of attribute html.
38 39 40 |
# File 'lib/canon/config.rb', line 38 def html @html end |
#json ⇒ Object (readonly)
Returns the value of attribute json.
38 39 40 |
# File 'lib/canon/config.rb', line 38 def json @json end |
#string ⇒ Object (readonly)
Returns the value of attribute string.
38 39 40 |
# File 'lib/canon/config.rb', line 38 def string @string end |
#xml ⇒ Object (readonly)
Returns the value of attribute xml.
38 39 40 |
# File 'lib/canon/config.rb', line 38 def xml @xml end |
#yaml ⇒ Object (readonly)
Returns the value of attribute yaml.
38 39 40 |
# File 'lib/canon/config.rb', line 38 def yaml @yaml end |
Class Method Details
.configure {|instance| ... } ⇒ Object
15 16 17 18 |
# File 'lib/canon/config.rb', line 15 def configure yield instance if block_given? instance end |
.instance ⇒ Object
11 12 13 |
# File 'lib/canon/config.rb', line 11 def instance @instance ||= new end |
.method_missing(method) ⇒ Object
Delegate to instance
25 26 27 28 29 30 31 |
# File 'lib/canon/config.rb', line 25 def method_missing(method, ...) if @instance.respond_to?(method) @instance.send(method, ...) else super end end |
.reset! ⇒ Object
20 21 22 |
# File 'lib/canon/config.rb', line 20 def reset! @instance = new end |
.respond_to_missing?(method, include_private = false) ⇒ Boolean
33 34 35 |
# File 'lib/canon/config.rb', line 33 def respond_to_missing?(method, include_private = false) @instance.respond_to?(method) || super end |
Instance Method Details
#diff_mode ⇒ Object
Backward compatibility methods for top-level diff configuration These delegate to XML diff config for backward compatibility
58 59 60 |
# File 'lib/canon/config.rb', line 58 def diff_mode @xml.diff.mode end |
#diff_mode=(value) ⇒ Object
62 63 64 |
# File 'lib/canon/config.rb', line 62 def diff_mode=(value) @xml.diff.mode = value end |
#html_match_profile ⇒ Object
83 84 85 |
# File 'lib/canon/config.rb', line 83 def html_match_profile @html.match.profile end |
#html_match_profile=(value) ⇒ Object
87 88 89 |
# File 'lib/canon/config.rb', line 87 def html_match_profile=(value) @html.match.profile = value end |
#reset! ⇒ Object
48 49 50 51 52 53 54 |
# File 'lib/canon/config.rb', line 48 def reset! @xml.reset! @html.reset! @json.reset! @yaml.reset! @string.reset! end |
#use_color ⇒ Object
66 67 68 |
# File 'lib/canon/config.rb', line 66 def use_color @xml.diff.use_color end |
#use_color=(value) ⇒ Object
70 71 72 |
# File 'lib/canon/config.rb', line 70 def use_color=(value) @xml.diff.use_color = value end |
#xml_match_profile ⇒ Object
Backward compatibility methods for match profile configuration
75 76 77 |
# File 'lib/canon/config.rb', line 75 def xml_match_profile @xml.match.profile end |
#xml_match_profile=(value) ⇒ Object
79 80 81 |
# File 'lib/canon/config.rb', line 79 def xml_match_profile=(value) @xml.match.profile = value end |