Class: AutoC::Module::Source

Inherits:
Object
  • Object
show all
Includes:
EntityContainer, SmartRenderer
Defined in:
lib/autoc/module.rb

Instance Attribute Summary collapse

Attributes included from SmartRenderer

#digest

Instance Method Summary collapse

Methods included from SmartRenderer

#render

Methods included from EntityContainer

#entities

Constructor Details

#initialize(m, index) ⇒ Source

Returns a new instance of Source.



262
263
264
265
266
# File 'lib/autoc/module.rb', line 262

def initialize(m, index)
  @module = m
  @complexity = 0
  @index = index
end

Instance Attribute Details

#complexityObject (readonly)

Returns the value of attribute complexity.



256
257
258
# File 'lib/autoc/module.rb', line 256

def complexity
  @complexity
end

#indexObject (readonly)

Returns the value of attribute index.



258
259
260
# File 'lib/autoc/module.rb', line 258

def index
  @index
end

#moduleObject (readonly)

Returns the value of attribute module.



254
255
256
# File 'lib/autoc/module.rb', line 254

def module
  @module
end

Instance Method Details

#<<(entity) ⇒ Object



268
269
270
271
# File 'lib/autoc/module.rb', line 268

def <<(entity)
  @complexity += entity.complexity unless entities.include?(entity)
  super
end

#file_nameObject



260
# File 'lib/autoc/module.rb', line 260

def file_name = self.module.source_count < 2 ? "#{self.module.name}_auto.c" : "#{self.module.name}_auto#{index}.c"