Class: Differ::Change
- Inherits:
-
Object
- Object
- Differ::Change
- Defined in:
- lib/differ/change.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#delete ⇒ Object
Returns the value of attribute delete.
-
#insert ⇒ Object
Returns the value of attribute insert.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #change? ⇒ Boolean
- #delete? ⇒ Boolean
-
#initialize(options = {}) ⇒ Change
constructor
A new instance of Change.
- #insert? ⇒ Boolean
- #to_s ⇒ Object (also: #inspect)
Constructor Details
#initialize(options = {}) ⇒ Change
Returns a new instance of Change.
4 5 6 7 |
# File 'lib/differ/change.rb', line 4 def initialize( = {}) @insert = [:insert] || '' @delete = [:delete] || '' end |
Instance Attribute Details
#delete ⇒ Object
Returns the value of attribute delete.
3 4 5 |
# File 'lib/differ/change.rb', line 3 def delete @delete end |
#insert ⇒ Object
Returns the value of attribute insert.
3 4 5 |
# File 'lib/differ/change.rb', line 3 def insert @insert end |
Instance Method Details
#==(other) ⇒ Object
26 27 28 |
# File 'lib/differ/change.rb', line 26 def ==(other) self.insert == other.insert && self.delete == other.delete end |
#change? ⇒ Boolean
17 18 19 |
# File 'lib/differ/change.rb', line 17 def change? !@insert.empty? && !@delete.empty? end |
#delete? ⇒ Boolean
13 14 15 |
# File 'lib/differ/change.rb', line 13 def delete? !@delete.empty? end |
#insert? ⇒ Boolean
9 10 11 |
# File 'lib/differ/change.rb', line 9 def insert? !@insert.empty? end |