Class: SVNx::Action
- Inherits:
-
Object
- Object
- SVNx::Action
- Includes:
- Comparable, Loggable
- Defined in:
- lib/svnx/action.rb
Overview
$$$ this cries for a little metaprogramming … tomorrow
Instance Attribute Summary collapse
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #added? ⇒ Boolean
- #deleted? ⇒ Boolean
-
#initialize(str) ⇒ Action
constructor
A new instance of Action.
- #modified? ⇒ Boolean
- #to_s ⇒ Object
- #unversioned? ⇒ Boolean
Constructor Details
#initialize(str) ⇒ Action
Returns a new instance of Action.
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/svnx/action.rb', line 15 def initialize str @type = case str when 'added', 'A', :added :added when 'deleted', 'D', :deleted :deleted when 'modified', 'M', :modified :modified when 'unversioned', '?', :unversioned :unversioned end end |
Instance Attribute Details
#type ⇒ Object (readonly)
Returns the value of attribute type.
13 14 15 |
# File 'lib/svnx/action.rb', line 13 def type @type end |
Instance Method Details
#<=>(other) ⇒ Object
44 45 46 |
# File 'lib/svnx/action.rb', line 44 def <=> other @type.to_s <=> other.type.to_s end |
#added? ⇒ Boolean
28 29 30 |
# File 'lib/svnx/action.rb', line 28 def added? @type == :added end |
#deleted? ⇒ Boolean
32 33 34 |
# File 'lib/svnx/action.rb', line 32 def deleted? @type == :deleted end |
#modified? ⇒ Boolean
36 37 38 |
# File 'lib/svnx/action.rb', line 36 def modified? @type == :modified end |
#to_s ⇒ Object
48 49 50 |
# File 'lib/svnx/action.rb', line 48 def to_s @type.to_s end |
#unversioned? ⇒ Boolean
40 41 42 |
# File 'lib/svnx/action.rb', line 40 def unversioned? @type == :unversioned end |