Class: SVNx::Action

Inherits:
Object
  • Object
show all
Includes:
Comparable, Loggable
Defined in:
lib/svnx/action.rb

Overview

$$$ this cries for a little metaprogramming … tomorrow

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#typeObject (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

Returns:

  • (Boolean)


28
29
30
# File 'lib/svnx/action.rb', line 28

def added?
  @type == :added
end

#deleted?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/svnx/action.rb', line 32

def deleted?
  @type == :deleted
end

#modified?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/svnx/action.rb', line 36

def modified?
  @type == :modified
end

#to_sObject



48
49
50
# File 'lib/svnx/action.rb', line 48

def to_s
  @type.to_s
end

#unversioned?Boolean

Returns:

  • (Boolean)


40
41
42
# File 'lib/svnx/action.rb', line 40

def unversioned?
  @type == :unversioned
end