Class: Svnx::Action
- Inherits:
-
Object
- Object
- Svnx::Action
- Includes:
- Comparable
- Defined in:
- lib/svnx/base/action.rb
Instance Attribute Summary collapse
-
#abbrev ⇒ Object
readonly
Returns the value of attribute abbrev.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
- #<=>(other) ⇒ Object
-
#initialize(type, abbrev) ⇒ Action
constructor
A new instance of Action.
- #to_s ⇒ Object
Constructor Details
#initialize(type, abbrev) ⇒ Action
Returns a new instance of Action.
29 30 31 32 |
# File 'lib/svnx/base/action.rb', line 29 def initialize type, abbrev @type = type.to_sym @abbrev = abbrev end |
Instance Attribute Details
#abbrev ⇒ Object (readonly)
Returns the value of attribute abbrev.
27 28 29 |
# File 'lib/svnx/base/action.rb', line 27 def abbrev @abbrev end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
26 27 28 |
# File 'lib/svnx/base/action.rb', line 26 def type @type end |
Class Method Details
.new(*args) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/svnx/base/action.rb', line 9 def new *args if args.length == 2 super else type = args.first types = constants false types.each do |t| tc = const_get t if tc.type == type.to_sym || tc.abbrev == type return tc end end raise "not a valid action type: #{type}" end end |
Instance Method Details
#<=>(other) ⇒ Object
34 35 36 |
# File 'lib/svnx/base/action.rb', line 34 def <=> other @type <=> other.type end |
#to_s ⇒ Object
38 39 40 |
# File 'lib/svnx/base/action.rb', line 38 def to_s @type.to_s end |