Class: Lookout::Diff::Group
- Includes:
- Enumerable
- Defined in:
- lib/lookout/diff/group.rb
Instance Method Summary collapse
- #<<(operation) ⇒ Object
- #==(other) ⇒ Object
- #each ⇒ Object
- #empty? ⇒ Boolean
- #fold(context) ⇒ Object
- #from ⇒ Object
-
#initialize(*operations) ⇒ Group
constructor
A new instance of Group.
- #inspect ⇒ Object
- #parity? ⇒ Boolean
- #to ⇒ Object
Constructor Details
#initialize(*operations) ⇒ Group
Returns a new instance of Group.
6 7 8 |
# File 'lib/lookout/diff/group.rb', line 6 def initialize(*operations) @operations = operations end |
Instance Method Details
#<<(operation) ⇒ Object
14 15 16 17 |
# File 'lib/lookout/diff/group.rb', line 14 def <<(operation) operations << operation self end |
#==(other) ⇒ Object
43 44 45 |
# File 'lib/lookout/diff/group.rb', line 43 def ==(other) operations == other.operations end |
#each ⇒ Object
28 29 30 31 32 33 |
# File 'lib/lookout/diff/group.rb', line 28 def each operations.each do |operation| yield operation end self end |
#empty? ⇒ Boolean
10 11 12 |
# File 'lib/lookout/diff/group.rb', line 10 def empty? operations.empty? end |
#fold(context) ⇒ Object
19 20 21 22 |
# File 'lib/lookout/diff/group.rb', line 19 def fold(context) operations[-1] = operations[-1] << context self end |
#from ⇒ Object
35 36 37 |
# File 'lib/lookout/diff/group.rb', line 35 def from range(:from) end |
#inspect ⇒ Object
47 48 49 |
# File 'lib/lookout/diff/group.rb', line 47 def inspect '<#%s %p>' % [self.class, operations] end |
#parity? ⇒ Boolean
24 25 26 |
# File 'lib/lookout/diff/group.rb', line 24 def parity? operations.size == 1 and operations.first.parity? end |
#to ⇒ Object
39 40 41 |
# File 'lib/lookout/diff/group.rb', line 39 def to range(:to) end |