Class: Level

Inherits:
EADElement
  • Object
show all
Defined in:
lib/elements/c.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeLevel

Returns a new instance of Level.



19
20
21
# File 'lib/elements/c.rb', line 19

def initialize
	@unnumbered = false
end

Instance Attribute Details

#parentObject (readonly)

Returns the value of attribute parent.



12
13
14
# File 'lib/elements/c.rb', line 12

def parent
  @parent
end

Instance Method Details

#__parent=(parent) ⇒ Object



38
39
40
41
42
43
# File 'lib/elements/c.rb', line 38

def __parent=(parent)
	super
	if parent.unnumbered?
		self.set_unnumbered
	end
end

#description_levelObject



45
46
47
48
49
50
51
# File 'lib/elements/c.rb', line 45

def description_level
  if __parent
    return __parent.description_level + 1
  else
    return 0
  end  
end

#set_numberedObject



27
28
29
# File 'lib/elements/c.rb', line 27

def set_numbered
	@unnumbered = false
end

#set_unnumberedObject



23
24
25
# File 'lib/elements/c.rb', line 23

def set_unnumbered
	@unnumbered = true
end

#unnumbered?Boolean

Returns:

  • (Boolean)


31
32
33
34
35
36
# File 'lib/elements/c.rb', line 31

def unnumbered?
  if not instance_variables.index('@unnumbered')
    @unnumbered = false
  end
  @unnumbered
end