Class: CBS::Container
- Inherits:
-
Object
- Object
- CBS::Container
- Defined in:
- lib/cbs.rb
Instance Attribute Summary collapse
-
#functions ⇒ Object
Returns the value of attribute functions.
-
#initializer ⇒ Object
Returns the value of attribute initializer.
-
#metaclass ⇒ Object
Returns the value of attribute metaclass.
-
#name ⇒ Object
Returns the value of attribute name.
-
#superclass ⇒ Object
Returns the value of attribute superclass.
Instance Method Summary collapse
- #format ⇒ Object
-
#initialize(name, superclass, metaclass, initializer, functions) ⇒ Container
constructor
A new instance of Container.
- #name_for_code ⇒ Object
Constructor Details
#initialize(name, superclass, metaclass, initializer, functions) ⇒ Container
Returns a new instance of Container.
188 189 190 |
# File 'lib/cbs.rb', line 188 def initialize(name, superclass, , initializer, functions) @name, @superclass, @metaclass, @initializer, @functions = name, superclass, , initializer, functions end |
Instance Attribute Details
#functions ⇒ Object
Returns the value of attribute functions.
187 188 189 |
# File 'lib/cbs.rb', line 187 def functions @functions end |
#initializer ⇒ Object
Returns the value of attribute initializer.
187 188 189 |
# File 'lib/cbs.rb', line 187 def initializer @initializer end |
#metaclass ⇒ Object
Returns the value of attribute metaclass.
187 188 189 |
# File 'lib/cbs.rb', line 187 def @metaclass end |
#name ⇒ Object
Returns the value of attribute name.
187 188 189 |
# File 'lib/cbs.rb', line 187 def name @name end |
#superclass ⇒ Object
Returns the value of attribute superclass.
187 188 189 |
# File 'lib/cbs.rb', line 187 def superclass @superclass end |
Instance Method Details
#format ⇒ Object
191 192 193 194 195 196 197 198 199 200 201 |
# File 'lib/cbs.rb', line 191 def format code = '' code += name_for_code code += "#{}.#{initializer}(" code += "#{superclass}, " unless superclass.nil? code += '{' code += functions.inject('') do |m, function| m += function.format(m.empty?) end code += "\n});\n\n" end |
#name_for_code ⇒ Object
203 204 205 206 207 208 209 210 |
# File 'lib/cbs.rb', line 203 def name_for_code return '' if name.nil? if (@name || '').include? '.' "#{@name} = " else "var #{@name} = " end end |