Class: Gorillib::DiffFormatter
- Inherits:
-
Object
- Object
- Gorillib::DiffFormatter
- Defined in:
- lib/gorillib/diff.rb
Instance Method Summary collapse
- #display_diff(this, other) ⇒ Object
-
#initialize(options = {}) ⇒ DiffFormatter
constructor
A new instance of DiffFormatter.
Constructor Details
#initialize(options = {}) ⇒ DiffFormatter
Returns a new instance of DiffFormatter.
140 141 142 143 144 145 146 147 148 149 |
# File 'lib/gorillib/diff.rb', line 140 def initialize( = {}) @drawer = ([:drawer] || DiffDrawer.new(stream: .delete(:stream), left: .delete(:left), right: .delete(:right), indentation: .delete(:indentation), tab_width: .delete(:tab_width))) @context_atoms = [:context_atoms] || 0 end |
Instance Method Details
#display_diff(this, other) ⇒ Object
151 152 153 154 155 156 157 158 159 160 161 162 163 |
# File 'lib/gorillib/diff.rb', line 151 def display_diff(this, other) setup if this.is_a?(Hash) && other.is_a?(Hash) display_diff_hash(this, other) elsif this.is_a?(Array) && other.is_a?(Array) display_diff_arr(this, other) elsif ((this.is_a?(Hash) != other.is_a?(Hash)) || (this.is_a?(Array) != other.is_a?(Array))) display_diff_hetero(this, other) else display_diff_atom(this, other) end end |