Class: SuperDiff::Core::Configuration
- Inherits:
-
Object
- Object
- SuperDiff::Core::Configuration
- Defined in:
- lib/super_diff/core/configuration.rb
Instance Attribute Summary collapse
-
#actual_color ⇒ Object
Returns the value of attribute actual_color.
-
#border_color ⇒ Object
Returns the value of attribute border_color.
-
#color_enabled ⇒ Object
Returns the value of attribute color_enabled.
-
#diff_elision_enabled ⇒ Object
Returns the value of attribute diff_elision_enabled.
-
#diff_elision_maximum ⇒ Object
Returns the value of attribute diff_elision_maximum.
-
#elision_marker_color ⇒ Object
Returns the value of attribute elision_marker_color.
-
#expected_color ⇒ Object
Returns the value of attribute expected_color.
-
#extra_diff_formatter_classes ⇒ Object
readonly
Returns the value of attribute extra_diff_formatter_classes.
-
#extra_differ_classes ⇒ Object
readonly
Returns the value of attribute extra_differ_classes.
-
#extra_inspection_tree_builder_classes ⇒ Object
readonly
Returns the value of attribute extra_inspection_tree_builder_classes.
-
#extra_operation_tree_builder_classes ⇒ Object
readonly
Returns the value of attribute extra_operation_tree_builder_classes.
-
#extra_operation_tree_classes ⇒ Object
readonly
Returns the value of attribute extra_operation_tree_classes.
-
#header_color ⇒ Object
Returns the value of attribute header_color.
-
#key_enabled ⇒ Object
Returns the value of attribute key_enabled.
Instance Method Summary collapse
- #add_extra_diff_formatter_classes(*classes) ⇒ Object (also: #add_extra_diff_formatter_class)
- #add_extra_differ_classes(*classes) ⇒ Object (also: #add_extra_differ_class)
- #add_extra_inspection_tree_builder_classes(*classes) ⇒ Object (also: #add_extra_inspection_tree_builder_class)
- #add_extra_operation_tree_builder_classes(*classes) ⇒ Object (also: #add_extra_operation_tree_builder_class)
- #add_extra_operation_tree_classes(*classes) ⇒ Object (also: #add_extra_operation_tree_class)
- #color_enabled? ⇒ Boolean
- #diff_elision_enabled? ⇒ Boolean
-
#initialize(options = {}) ⇒ Configuration
constructor
A new instance of Configuration.
- #initialize_dup(original) ⇒ Object
- #key_enabled? ⇒ Boolean
- #merge!(configuration_or_options) ⇒ Object
- #prepend_extra_diff_formatter_classes(*classes) ⇒ Object (also: #prepend_extra_diff_formatter_class)
- #prepend_extra_differ_classes(*classes) ⇒ Object (also: #prepend_extra_differ_class)
- #prepend_extra_inspection_tree_builder_classes(*classes) ⇒ Object (also: #prepend_extra_inspection_tree_builder_class)
- #prepend_extra_operation_tree_builder_classes(*classes) ⇒ Object (also: #prepend_extra_operation_tree_builder_class)
- #prepend_extra_operation_tree_classes(*classes) ⇒ Object (also: #prepend_extra_operation_tree_class)
- #to_h ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Configuration
Returns a new instance of Configuration.
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/super_diff/core/configuration.rb', line 25 def initialize( = {}) @actual_color = :yellow @border_color = :blue @color_enabled = nil @diff_elision_enabled = false @diff_elision_maximum = 0 @elision_marker_color = :cyan @expected_color = :magenta @extra_diff_formatter_classes = [].freeze @extra_differ_classes = [].freeze @extra_inspection_tree_builder_classes = [].freeze @extra_operation_tree_builder_classes = [].freeze @extra_operation_tree_classes = [].freeze @header_color = :white @key_enabled = true merge!() end |
Instance Attribute Details
#actual_color ⇒ Object
Returns the value of attribute actual_color.
13 14 15 |
# File 'lib/super_diff/core/configuration.rb', line 13 def actual_color @actual_color end |
#border_color ⇒ Object
Returns the value of attribute border_color.
13 14 15 |
# File 'lib/super_diff/core/configuration.rb', line 13 def border_color @border_color end |
#color_enabled ⇒ Object
Returns the value of attribute color_enabled.
13 14 15 |
# File 'lib/super_diff/core/configuration.rb', line 13 def color_enabled @color_enabled end |
#diff_elision_enabled ⇒ Object
Returns the value of attribute diff_elision_enabled.
13 14 15 |
# File 'lib/super_diff/core/configuration.rb', line 13 def diff_elision_enabled @diff_elision_enabled end |
#diff_elision_maximum ⇒ Object
Returns the value of attribute diff_elision_maximum.
13 14 15 |
# File 'lib/super_diff/core/configuration.rb', line 13 def diff_elision_maximum @diff_elision_maximum end |
#elision_marker_color ⇒ Object
Returns the value of attribute elision_marker_color.
13 14 15 |
# File 'lib/super_diff/core/configuration.rb', line 13 def elision_marker_color @elision_marker_color end |
#expected_color ⇒ Object
Returns the value of attribute expected_color.
13 14 15 |
# File 'lib/super_diff/core/configuration.rb', line 13 def expected_color @expected_color end |
#extra_diff_formatter_classes ⇒ Object (readonly)
Returns the value of attribute extra_diff_formatter_classes.
6 7 8 |
# File 'lib/super_diff/core/configuration.rb', line 6 def extra_diff_formatter_classes @extra_diff_formatter_classes end |
#extra_differ_classes ⇒ Object (readonly)
Returns the value of attribute extra_differ_classes.
6 7 8 |
# File 'lib/super_diff/core/configuration.rb', line 6 def extra_differ_classes @extra_differ_classes end |
#extra_inspection_tree_builder_classes ⇒ Object (readonly)
Returns the value of attribute extra_inspection_tree_builder_classes.
6 7 8 |
# File 'lib/super_diff/core/configuration.rb', line 6 def extra_inspection_tree_builder_classes @extra_inspection_tree_builder_classes end |
#extra_operation_tree_builder_classes ⇒ Object (readonly)
Returns the value of attribute extra_operation_tree_builder_classes.
6 7 8 |
# File 'lib/super_diff/core/configuration.rb', line 6 def extra_operation_tree_builder_classes @extra_operation_tree_builder_classes end |
#extra_operation_tree_classes ⇒ Object (readonly)
Returns the value of attribute extra_operation_tree_classes.
6 7 8 |
# File 'lib/super_diff/core/configuration.rb', line 6 def extra_operation_tree_classes @extra_operation_tree_classes end |
#header_color ⇒ Object
Returns the value of attribute header_color.
13 14 15 |
# File 'lib/super_diff/core/configuration.rb', line 13 def header_color @header_color end |
#key_enabled ⇒ Object
Returns the value of attribute key_enabled.
13 14 15 |
# File 'lib/super_diff/core/configuration.rb', line 13 def key_enabled @key_enabled end |
Instance Method Details
#add_extra_diff_formatter_classes(*classes) ⇒ Object Also known as: add_extra_diff_formatter_class
82 83 84 85 |
# File 'lib/super_diff/core/configuration.rb', line 82 def add_extra_diff_formatter_classes(*classes) @extra_diff_formatter_classes = (@extra_diff_formatter_classes + classes).freeze end |
#add_extra_differ_classes(*classes) ⇒ Object Also known as: add_extra_differ_class
94 95 96 |
# File 'lib/super_diff/core/configuration.rb', line 94 def add_extra_differ_classes(*classes) @extra_differ_classes = (@extra_differ_classes + classes).freeze end |
#add_extra_inspection_tree_builder_classes(*classes) ⇒ Object Also known as: add_extra_inspection_tree_builder_class
104 105 106 107 |
# File 'lib/super_diff/core/configuration.rb', line 104 def add_extra_inspection_tree_builder_classes(*classes) @extra_inspection_tree_builder_classes = (@extra_inspection_tree_builder_classes + classes).freeze end |
#add_extra_operation_tree_builder_classes(*classes) ⇒ Object Also known as: add_extra_operation_tree_builder_class
116 117 118 119 |
# File 'lib/super_diff/core/configuration.rb', line 116 def add_extra_operation_tree_builder_classes(*classes) @extra_operation_tree_builder_classes = (@extra_operation_tree_builder_classes + classes).freeze end |
#add_extra_operation_tree_classes(*classes) ⇒ Object Also known as: add_extra_operation_tree_class
128 129 130 131 |
# File 'lib/super_diff/core/configuration.rb', line 128 def add_extra_operation_tree_classes(*classes) @extra_operation_tree_classes = (@extra_operation_tree_classes + classes).freeze end |
#color_enabled? ⇒ Boolean
57 58 59 60 61 |
# File 'lib/super_diff/core/configuration.rb', line 57 def color_enabled? return color_enabled_by_default? if @color_enabled.nil? @color_enabled end |
#diff_elision_enabled? ⇒ Boolean
63 64 65 |
# File 'lib/super_diff/core/configuration.rb', line 63 def diff_elision_enabled? @diff_elision_enabled end |
#initialize_dup(original) ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/super_diff/core/configuration.rb', line 44 def initialize_dup(original) super @extra_diff_formatter_classes = original.extra_diff_formatter_classes.dup.freeze @extra_differ_classes = original.extra_differ_classes.dup.freeze @extra_operation_tree_builder_classes = original.extra_operation_tree_builder_classes.dup.freeze @extra_operation_tree_classes = original.extra_operation_tree_classes.dup.freeze @extra_inspection_tree_builder_classes = original.extra_inspection_tree_builder_classes.dup.freeze end |
#key_enabled? ⇒ Boolean
67 68 69 |
# File 'lib/super_diff/core/configuration.rb', line 67 def key_enabled? @key_enabled end |
#merge!(configuration_or_options) ⇒ Object
71 72 73 74 75 76 77 78 79 80 |
# File 'lib/super_diff/core/configuration.rb', line 71 def merge!() = if .is_a?(self.class) .to_h else end .each { |key, value| instance_variable_set("@#{key}", value) } end |
#prepend_extra_diff_formatter_classes(*classes) ⇒ Object Also known as: prepend_extra_diff_formatter_class
88 89 90 91 |
# File 'lib/super_diff/core/configuration.rb', line 88 def prepend_extra_diff_formatter_classes(*classes) @extra_diff_formatter_classes = (classes + @extra_diff_formatter_classes).freeze end |
#prepend_extra_differ_classes(*classes) ⇒ Object Also known as: prepend_extra_differ_class
99 100 101 |
# File 'lib/super_diff/core/configuration.rb', line 99 def prepend_extra_differ_classes(*classes) @extra_differ_classes = (classes + @extra_differ_classes).freeze end |
#prepend_extra_inspection_tree_builder_classes(*classes) ⇒ Object Also known as: prepend_extra_inspection_tree_builder_class
110 111 112 113 |
# File 'lib/super_diff/core/configuration.rb', line 110 def prepend_extra_inspection_tree_builder_classes(*classes) @extra_inspection_tree_builder_classes = (classes + @extra_inspection_tree_builder_classes).freeze end |
#prepend_extra_operation_tree_builder_classes(*classes) ⇒ Object Also known as: prepend_extra_operation_tree_builder_class
122 123 124 125 |
# File 'lib/super_diff/core/configuration.rb', line 122 def prepend_extra_operation_tree_builder_classes(*classes) @extra_operation_tree_builder_classes = (classes + @extra_operation_tree_builder_classes).freeze end |
#prepend_extra_operation_tree_classes(*classes) ⇒ Object Also known as: prepend_extra_operation_tree_class
134 135 136 137 |
# File 'lib/super_diff/core/configuration.rb', line 134 def prepend_extra_operation_tree_classes(*classes) @extra_operation_tree_classes = (classes + @extra_operation_tree_classes).freeze end |
#to_h ⇒ Object
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 |
# File 'lib/super_diff/core/configuration.rb', line 140 def to_h { actual_color: actual_color, border_color: border_color, color_enabled: @color_enabled, diff_elision_enabled: diff_elision_enabled?, diff_elision_maximum: diff_elision_maximum, elision_marker_color: elision_marker_color, expected_color: expected_color, extra_diff_formatter_classes: extra_diff_formatter_classes.dup, extra_differ_classes: extra_differ_classes.dup, extra_inspection_tree_builder_classes: extra_inspection_tree_builder_classes.dup, extra_operation_tree_builder_classes: extra_operation_tree_builder_classes.dup, extra_operation_tree_classes: extra_operation_tree_classes.dup, header_color: header_color, key_enabled: key_enabled? } end |