Class: LanguageParser::ClassVariable

Inherits:
Object
  • Object
show all
Defined in:
lib/cgialib/lp/Language.rb

Direct Known Subclasses

JavaVariable

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeClassVariable

initialize()

Constructor



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/cgialib/lp/Language.rb', line 18

def initialize()
  
  @name = nil
  @type = nil
  @static = false
  @const = false
  @visibility = nil
  @value = nil
  @comment = ""
  
end

Instance Attribute Details

#commentObject

The comment surrounding the variable



42
43
44
# File 'lib/cgialib/lp/Language.rb', line 42

def comment
  @comment
end

#constObject

True if it’s const



36
37
38
# File 'lib/cgialib/lp/Language.rb', line 36

def const
  @const
end

#nameObject

The name of the variable



30
31
32
# File 'lib/cgialib/lp/Language.rb', line 30

def name
  @name
end

#staticObject

True if it’s static



34
35
36
# File 'lib/cgialib/lp/Language.rb', line 34

def static
  @static
end

#typeObject

The type of the variable



32
33
34
# File 'lib/cgialib/lp/Language.rb', line 32

def type
  @type
end

#valueObject

The value of the variable



40
41
42
# File 'lib/cgialib/lp/Language.rb', line 40

def value
  @value
end

#visibilityObject

“public”, “private” or “protected”



38
39
40
# File 'lib/cgialib/lp/Language.rb', line 38

def visibility
  @visibility
end

Instance Method Details

#to_sObject

to_s()

Pretty printing the variable



48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/cgialib/lp/Language.rb', line 48

def to_s()
  
  text = "#{name} - #{type}"
  
  text += " - #{@visibility}" if ( @visibility )
  text += " - const" if ( @const )
  text += " - static" if ( @static )
  text += " = #{@value}" if ( @value )
  
  text
  
end