Module: Gash::Helpers
Overview
Some common methods used by both Tree and Blob.
Instance Attribute Summary collapse
-
#mode ⇒ Object
Returns the value of attribute mode.
-
#parent ⇒ Object
Returns the value of attribute parent.
-
#sha1 ⇒ Object
Returns the value of attribute sha1.
Instance Method Summary collapse
-
#blob? ⇒ Boolean
Checks if this is a Blob.
-
#changed! ⇒ Object
Mark this, and all parents as changed.
-
#changed? ⇒ Boolean
Checks if this object has been changed (since last commit).
-
#gash ⇒ Object
Returns the Gash-object (top-parent).
-
#initialize(opts = {}) ⇒ Object
Sets the accessors using a Hash:.
-
#tree? ⇒ Boolean
Checks if this is a Tree.
Instance Attribute Details
#mode ⇒ Object
Returns the value of attribute mode.
36 37 38 |
# File 'lib/gash.rb', line 36 def mode @mode end |
#parent ⇒ Object
Returns the value of attribute parent.
36 37 38 |
# File 'lib/gash.rb', line 36 def parent @parent end |
#sha1 ⇒ Object
Returns the value of attribute sha1.
36 37 38 |
# File 'lib/gash.rb', line 36 def sha1 @sha1 end |
Instance Method Details
#blob? ⇒ Boolean
Checks if this is a Blob.
52 |
# File 'lib/gash.rb', line 52 def blob?; self.class == Gash::Blob end |
#changed! ⇒ Object
Mark this, and all parents as changed.
58 |
# File 'lib/gash.rb', line 58 def changed!; @sha1 = nil;parent.changed! end |
#changed? ⇒ Boolean
Checks if this object has been changed (since last commit).
56 |
# File 'lib/gash.rb', line 56 def changed?; !@sha1 end |
#gash ⇒ Object
Returns the Gash-object (top-parent).
60 |
# File 'lib/gash.rb', line 60 def gash; parent.gash end |
#initialize(opts = {}) ⇒ Object
45 46 47 48 49 |
# File 'lib/gash.rb', line 45 def initialize(opts = {}) opts.each do |key, value| send("#{key}=", value) end end |