Class: Lookout::Diff::Algorithms::Difflib::Position
- Defined in:
- lib/lookout/diff/algorithms/difflib/position.rb
Defined Under Namespace
Classes: To
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object
- #begin_after(match) ⇒ Object
- #begins_before?(match) ⇒ Boolean
- #end_before(match) ⇒ Object
- #ends_after?(match) ⇒ Boolean
-
#initialize(from, to, junk) ⇒ Position
constructor
A new instance of Position.
- #inspect ⇒ Object
- #match ⇒ Object
Constructor Details
#initialize(from, to, junk) ⇒ Position
Returns a new instance of Position.
17 18 19 |
# File 'lib/lookout/diff/algorithms/difflib/position.rb', line 17 def initialize(from, to, junk) @from, @to, @junk = from, to, junk end |
Class Method Details
Instance Method Details
#==(other) ⇒ Object
42 43 44 |
# File 'lib/lookout/diff/algorithms/difflib/position.rb', line 42 def ==(other) from == other.from and to == other.to and junk == other.junk end |
#begin_after(match) ⇒ Object
34 35 36 |
# File 'lib/lookout/diff/algorithms/difflib/position.rb', line 34 def begin_after(match) self.class.new(from.begin_after(match.from), to.begin_after(match.to), junk) end |
#begins_before?(match) ⇒ Boolean
26 27 28 |
# File 'lib/lookout/diff/algorithms/difflib/position.rb', line 26 def begins_before?(match) from.begins_before? match.from and to.begins_before? match.to end |
#end_before(match) ⇒ Object
38 39 40 |
# File 'lib/lookout/diff/algorithms/difflib/position.rb', line 38 def end_before(match) self.class.new(from.end_before(match.from), to.end_before(match.to), junk) end |
#ends_after?(match) ⇒ Boolean
30 31 32 |
# File 'lib/lookout/diff/algorithms/difflib/position.rb', line 30 def ends_after?(match) from.ends_after? match.from and to.ends_after? match.to end |
#inspect ⇒ Object
46 47 48 |
# File 'lib/lookout/diff/algorithms/difflib/position.rb', line 46 def inspect '#<%s %p,%p>' % [self.class, from, to] end |
#match ⇒ Object
21 22 23 24 |
# File 'lib/lookout/diff/algorithms/difflib/position.rb', line 21 def match match = leftmost_longest junk.empty? ? match : ((match, false), true) end |