Class: HilferItem

Inherits:
Object
  • Object
show all
Defined in:
lib/hilfer/hilfer_item.rb

Overview

HilferItems are stored in the TreeModel

  • item is the display name (ie filename and extension)
  • path is the full pathname, expanded, unqualified etc etc
  • last_child_used is the GtkTreeView path of the last child of a directory node that had selection
  • status is either :expanded or :collapsed
  • populated is whether or not this directory node has been populated from the filesystem. To aid in recursively populating the tree

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(item, path) ⇒ HilferItem

Returns a new instance of HilferItem.



15
16
17
18
19
20
21
22
# File 'lib/hilfer/hilfer_item.rb', line 15

def initialize( item, path )
  @item = item
  @path = path
  @dir = File.directory? path
  @populated = false
  @status = :collapsed
  @colour = '#000'
end

Instance Attribute Details

#colour ⇒ Object

Returns the value of attribute colour.



12
13
14
# File 'lib/hilfer/hilfer_item.rb', line 12

def colour
  @colour
end

#item ⇒ Object

Returns the value of attribute item.



12
13
14
# File 'lib/hilfer/hilfer_item.rb', line 12

def item
  @item
end

#last_child_used ⇒ Object

Returns the value of attribute last_child_used.



12
13
14
# File 'lib/hilfer/hilfer_item.rb', line 12

def last_child_used
  @last_child_used
end

#path ⇒ Object

Returns the value of attribute path.



12
13
14
# File 'lib/hilfer/hilfer_item.rb', line 12

def path
  @path
end

#populated=(value) ⇒ Object (writeonly)

Sets the attribute populated

Parameters:

  • value —

    the value to set the attribute populated to.



13
14
15
# File 'lib/hilfer/hilfer_item.rb', line 13

def populated=(value)
  @populated = value
end

#status ⇒ Object

Returns the value of attribute status.



12
13
14
# File 'lib/hilfer/hilfer_item.rb', line 12

def status
  @status
end

#svn_status ⇒ Object

Returns the value of attribute svn_status.



12
13
14
# File 'lib/hilfer/hilfer_item.rb', line 12

def svn_status
  @svn_status
end

Instance Method Details

#dir? ⇒ Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/hilfer/hilfer_item.rb', line 24

def dir?
  @dir
end

#expanded? ⇒ Boolean

always return false for file nodes

Returns:

  • (Boolean)


42
43
44
45
46
47
48
# File 'lib/hilfer/hilfer_item.rb', line 42

def expanded?
  if !dir?
    false
  else
    @status == :expanded
  end
end

#populated? ⇒ Boolean

always return true for file nodes

Returns:

  • (Boolean)


33
34
35
36
37
38
39
# File 'lib/hilfer/hilfer_item.rb', line 33

def populated?
  if !dir?
    true
  else
    @populated
  end
end

#to_s ⇒ Object



28
29
30
# File 'lib/hilfer/hilfer_item.rb', line 28

def to_s
  @item
end