Class: Dandelion::Changeset
- Inherits:
-
Object
- Object
- Dandelion::Changeset
- Includes:
- Enumerable
- Defined in:
- lib/dandelion/changeset.rb
Instance Method Summary collapse
- #diff ⇒ Object
- #each ⇒ Object
- #empty? ⇒ Boolean
-
#initialize(tree, commit, options = {}) ⇒ Changeset
constructor
A new instance of Changeset.
Constructor Details
#initialize(tree, commit, options = {}) ⇒ Changeset
Returns a new instance of Changeset.
5 6 7 8 9 |
# File 'lib/dandelion/changeset.rb', line 5 def initialize(tree, commit, = {}) @tree = tree @commit = commit @options = end |
Instance Method Details
#diff ⇒ Object
11 12 13 |
# File 'lib/dandelion/changeset.rb', line 11 def diff Diff.new(@commit, @tree.commit) end |
#each ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/dandelion/changeset.rb', line 19 def each diff.each do |change| if applicable?(change.path) path = transform_path(change.path) if change.type == :delete yield Change.new(path, change.type) else read = -> { @tree.data(change.path) } if @tree.symlink?(change.path) yield Change.new(path, :symlink, read) else yield Change.new(path, change.type, read) end end end end end |
#empty? ⇒ Boolean
15 16 17 |
# File 'lib/dandelion/changeset.rb', line 15 def empty? diff.empty? end |