Class: AutoC::Module
Direct Known Subclasses
Docs
Defined Under Namespace
Modules: EntityContainer, SmartRenderer
Classes: Builder, Header, Source, State, StreamFile
Constant Summary
collapse
- CAP =
"/* Automagically generated by AutoC #{AutoC::VERSION} */"
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
#<<, #entities
Constructor Details
#initialize(name, stateful: true) ⇒ Module
Returns a new instance of Module.
55
56
57
58
|
# File 'lib/autoc/module.rb', line 55
def initialize(name, stateful: true)
@name = name
@stateful = stateful
end
|
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
47
48
49
|
# File 'lib/autoc/module.rb', line 47
def name
@name
end
|
#source_count ⇒ Object
Returns the value of attribute source_count.
49
50
51
|
# File 'lib/autoc/module.rb', line 49
def source_count
@source_count
end
|
#source_threshold ⇒ Object
Returns the value of attribute source_threshold.
51
52
53
|
# File 'lib/autoc/module.rb', line 51
def source_threshold
@source_threshold
end
|
Class Method Details
.render(name) {|m| ... } ⇒ Object
93
94
95
96
97
|
# File 'lib/autoc/module.rb', line 93
def self.render(name, **, &code)
m = self.new(name, **)
yield(m) if block_given?
m.render
end
|
Instance Method Details
#digests ⇒ Object
64
|
# File 'lib/autoc/module.rb', line 64
def digests = @digests ||= State.new(self).read
|
60
|
# File 'lib/autoc/module.rb', line 60
def = @header ||= Header.new(self)
|
#render ⇒ Object
66
67
68
69
70
71
72
|
# File 'lib/autoc/module.rb', line 66
def render
distribute_entities
.render
sources.each(&:render)
State.new(self).collect.write if stateful?
self
end
|
#sources ⇒ Object
62
|
# File 'lib/autoc/module.rb', line 62
def sources = @sources ||= (1..source_count).collect { |i| Source.new(self, i) }
|
#stateful? ⇒ Boolean
53
|
# File 'lib/autoc/module.rb', line 53
def stateful? = @stateful == true
|
#total_entities ⇒ Object
74
75
76
77
78
79
80
|
# File 'lib/autoc/module.rb', line 74
def total_entities
@total_entities ||= begin
set = ::Set.new
entities.each { |e| set.merge(e.total_references) }
set
end
end
|