Class: Svnx::Log::EntryPath

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/svnx/log/entrypath.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attr: nil, kind: nil, action: nil, name: nil, prop_mods: nil, text_mods: nil) ⇒ EntryPath

Returns a new instance of EntryPath.



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/svnx/log/entrypath.rb', line 17

def initialize attr: nil, kind: nil, action: nil, name: nil, prop_mods: nil, text_mods: nil
  if attr
    @kind = attribute_value attr, 'kind'
    @action = Svnx::Action.new(attribute_value attr, 'action')
    @name = attr.text
    @prop_mods = "true" == attribute_value(attr, 'prop-mods')
    @text_mods = "true" == attribute_value(attr, 'text-mods')
  else
    @kind = kind
    @action = action
    @name = name
    @prop_mods = prop_mods
    @text_mods = text_mods
  end
end

Instance Attribute Details

#actionObject (readonly)

Returns the value of attribute action.



15
16
17
# File 'lib/svnx/log/entrypath.rb', line 15

def action
  @action
end

#kindObject (readonly)

Returns the value of attribute kind.



15
16
17
# File 'lib/svnx/log/entrypath.rb', line 15

def kind
  @kind
end

#nameObject (readonly)

Returns the value of attribute name.



15
16
17
# File 'lib/svnx/log/entrypath.rb', line 15

def name
  @name
end

#prop_modsObject (readonly)

Returns the value of attribute prop_mods.



15
16
17
# File 'lib/svnx/log/entrypath.rb', line 15

def prop_mods
  @prop_mods
end

#text_modsObject (readonly)

Returns the value of attribute text_mods.



15
16
17
# File 'lib/svnx/log/entrypath.rb', line 15

def text_mods
  @text_mods
end

Instance Method Details

#<=>(other) ⇒ Object



41
42
43
# File 'lib/svnx/log/entrypath.rb', line 41

def <=> other
  name <=> other.name
end

#attribute_value(xmlelement, attrname, meth = nil) ⇒ Object



49
50
51
52
# File 'lib/svnx/log/entrypath.rb', line 49

def attribute_value xmlelement, attrname, meth = nil
  value = xmlelement[attrname.to_s]
  meth ? value.send(meth) : value
end

#inspectObject



37
38
39
# File 'lib/svnx/log/entrypath.rb', line 37

def inspect
  to_s
end

#match?(action, filter) ⇒ Boolean

Returns:

  • (Boolean)


45
46
47
# File 'lib/svnx/log/entrypath.rb', line 45

def match? action, filter
  @action.to_s == action.to_s && @name.start_with?(filter)
end

#to_sObject



33
34
35
# File 'lib/svnx/log/entrypath.rb', line 33

def to_s
  @name
end