Class: Svnx::Status::Entry

Inherits:
Base::Entry show all
Includes:
Comparable
Defined in:
lib/svnx/status/entry.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base::Entry

#attribute_value, #element_text, #set_attr_var, #set_attr_vars, #set_elmt_var, #set_elmt_vars, #set_var

Constructor Details

#initialize(xmlelement, rootpath: nil) ⇒ Entry

Returns a new instance of Entry.



48
49
50
51
# File 'lib/svnx/status/entry.rb', line 48

def initialize xmlelement, rootpath: nil
  @rootpath = rootpath
  super xmlelement
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



44
45
46
# File 'lib/svnx/status/entry.rb', line 44

def name
  @name
end

#pathObject (readonly)

Returns the value of attribute path.



45
46
47
# File 'lib/svnx/status/entry.rb', line 45

def path
  @path
end

#working_copyObject (readonly)

Returns the value of attribute working_copy.



46
47
48
# File 'lib/svnx/status/entry.rb', line 46

def working_copy
  @working_copy
end

Instance Method Details

#<=>(other) ⇒ Object



71
72
73
# File 'lib/svnx/status/entry.rb', line 71

def <=> other
  path <=> other.path
end

#set_from_element(elmt) ⇒ Object



53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/svnx/status/entry.rb', line 53

def set_from_element elmt
  set_attr_var elmt, 'path'
  wcstatus = elmt.at_xpath 'wc-status'
  
  @name = @path.dup

  @working_copy = WorkingCopy.new wcstatus

  if @rootpath
    # name is prefixed with directory unless '.' is used as the argument
    @name.sub! Regexp.new('^' + @rootpath), ''
  end
end

#to_sObject



67
68
69
# File 'lib/svnx/status/entry.rb', line 67

def to_s
  " #{@path}: #{@status}"
end