Class: SourceTreeNode

Inherits:
Object
  • Object
show all
Defined in:
ext/ae-editor/ae-editor.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parent = nil, kind = 'class', sortable = true) {|_self| ... } ⇒ SourceTreeNode

Returns a new instance of SourceTreeNode.

Yields:

  • (_self)

Yield Parameters:


19
20
21
22
23
24
25
26
27
28
# File 'ext/ae-editor/ae-editor.rb', line 19

def initialize(parent=nil, kind='class', sortable=true)
  @sons = Array.new
  @parent = parent
  @kind = kind
  @sortable = sortable
  if @parent !=nil
    @parent.sons << self
  end
  yield(self) if block_given?
end

Instance Attribute Details

#argsObject

Returns the value of attribute args


18
19
20
# File 'ext/ae-editor/ae-editor.rb', line 18

def args
  @args
end

#helptextObject

Returns the value of attribute helptext


18
19
20
# File 'ext/ae-editor/ae-editor.rb', line 18

def helptext
  @helptext
end

#kindObject (readonly)

Returns the value of attribute kind


17
18
19
# File 'ext/ae-editor/ae-editor.rb', line 17

def kind
  @kind
end

#labelObject

Returns the value of attribute label


18
19
20
# File 'ext/ae-editor/ae-editor.rb', line 18

def label
  @label
end

#parentObject (readonly)

Returns the value of attribute parent


16
17
18
# File 'ext/ae-editor/ae-editor.rb', line 16

def parent
  @parent
end

#rifObject

Returns the value of attribute rif


18
19
20
# File 'ext/ae-editor/ae-editor.rb', line 18

def rif
  @rif
end

#rif_endObject

Returns the value of attribute rif_end


18
19
20
# File 'ext/ae-editor/ae-editor.rb', line 18

def rif_end
  @rif_end
end

#sonsObject (readonly)

Returns the value of attribute sons


15
16
17
# File 'ext/ae-editor/ae-editor.rb', line 15

def sons
  @sons
end

#sortableObject

Returns the value of attribute sortable


18
19
20
# File 'ext/ae-editor/ae-editor.rb', line 18

def sortable
  @sortable
end

Instance Method Details

#<=>(other) ⇒ Object


30
31
32
33
34
35
36
37
38
# File 'ext/ae-editor/ae-editor.rb', line 30

def <=> (other)
  if self.sortable && other.sortable
    self.label.strip <=> other.label.strip
  elsif !self.sortable
    -1
  elsif !other.sortable
    1
  end
end