Class: Bud::LatticePushElement
- Inherits:
-
Object
- Object
- Bud::LatticePushElement
show all
- Defined in:
- lib/bud/lattice-core.rb
Instance Attribute Summary (collapse)
Instance Method Summary
(collapse)
Constructor Details
A new instance of LatticePushElement
119
120
121
122
123
124
125
126
127
|
# File 'lib/bud/lattice-core.rb', line 119
def initialize(bud_instance)
@bud_instance = bud_instance
@wired_by = []
@outputs = []
@pendings = []
@deletes = []
@invalidated = true
@rescan = true
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
- (Object) method_missing(meth, *args, &blk)
181
182
183
184
185
186
187
|
# File 'lib/bud/lattice-core.rb', line 181
def method_missing(meth, *args, &blk)
if @bud_instance.wiring?
Bud::PushApplyMethod.new(@bud_instance, self, meth, args, blk)
else
super
end
end
|
Instance Attribute Details
- (Object) invalidated
Returns the value of attribute invalidated
117
118
119
|
# File 'lib/bud/lattice-core.rb', line 117
def invalidated
@invalidated
end
|
- (Object) outputs
Returns the value of attribute outputs
116
117
118
|
# File 'lib/bud/lattice-core.rb', line 116
def outputs
@outputs
end
|
- (Object) rescan
Returns the value of attribute rescan
117
118
119
|
# File 'lib/bud/lattice-core.rb', line 117
def rescan
@rescan
end
|
- (Object) wired_by
Returns the value of attribute wired_by
116
117
118
|
# File 'lib/bud/lattice-core.rb', line 116
def wired_by
@wired_by
end
|
Instance Method Details
- (Object) add_rescan_invalidate(rescan, invalidate)
230
231
|
# File 'lib/bud/lattice-core.rb', line 230
def add_rescan_invalidate(rescan, invalidate)
end
|
- (Object) check_wiring
144
145
146
147
148
|
# File 'lib/bud/lattice-core.rb', line 144
def check_wiring
if @outputs.empty? and @pendings.empty? and @deletes.empty?
raise Bud::Error, "no output specified for #{inspect}"
end
end
|
- (Object) flush
223
224
|
# File 'lib/bud/lattice-core.rb', line 223
def flush
end
|
- (Object) insert(v, source)
190
191
192
|
# File 'lib/bud/lattice-core.rb', line 190
def insert(v, source)
push_out(v)
end
|
- (Object) inspect
173
174
175
|
# File 'lib/bud/lattice-core.rb', line 173
def inspect
"#{self.class}:#{self.object_id.to_s(16)}"
end
|
- (Object) invalidate_at_tick(rescan, invalidate)
233
234
|
# File 'lib/bud/lattice-core.rb', line 233
def invalidate_at_tick(rescan, invalidate)
end
|
- (Object) invalidate_cache
236
237
|
# File 'lib/bud/lattice-core.rb', line 236
def invalidate_cache
end
|
- (Object) print_wiring(depth = 0, accum = "")
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
|
# File 'lib/bud/lattice-core.rb', line 150
def print_wiring(depth=0, accum="")
puts "#{' ' * depth}#{accum} #{inspect}"
[@outputs, @pendings, @deletes].each do |buf|
next_accum = case buf
when @outputs
"=> "
when @pendings
"+> "
when @deletes
"-> "
end
buf.each do |o|
if o.respond_to? :print_wiring
o.print_wiring(depth + 1, next_accum)
else
puts "#{' ' * (depth + 1)}#{next_accum} #{o.inspect}"
end
end
end
end
|
- (Object) push_out(v)
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
|
# File 'lib/bud/lattice-core.rb', line 194
def push_out(v)
@outputs.each do |o|
if o.class <= Bud::BudCollection
o <= (v.class <= Bud::Lattice ? v.reveal : v)
else
o.insert(v, self)
end
end
@pendings.each do |o|
if o.class <= Bud::BudCollection
o.pending_merge(v.class <= Bud::Lattice ? v.reveal : v)
else
o <+ v
end
end
@deletes.each do |o|
raise Bud::Error unless o.class <= Bud::BudCollection
o.pending_delete(v.class <= Bud::Lattice ? v.reveal : v)
end
end
|
- (Object) rescan_at_tick
246
247
248
|
# File 'lib/bud/lattice-core.rb', line 246
def rescan_at_tick
false
end
|
- (Object) stratum_end
226
227
|
# File 'lib/bud/lattice-core.rb', line 226
def stratum_end
end
|
- (Object) tick
240
241
|
# File 'lib/bud/lattice-core.rb', line 240
def tick
end
|
- (Object) tick_deltas
243
244
|
# File 'lib/bud/lattice-core.rb', line 243
def tick_deltas
end
|
- (Object) wire_to(element, kind = :output)
129
130
131
132
133
134
135
136
137
138
139
140
141
142
|
# File 'lib/bud/lattice-core.rb', line 129
def wire_to(element, kind=:output)
case kind
when :output
@outputs << element
when :pending
@pendings << element
when :delete
@deletes << element
else
raise Bud::Error, "unrecognized wiring kind: #{kind}"
end
element.wired_by << self
end
|
- (Object) wirings
177
178
179
|
# File 'lib/bud/lattice-core.rb', line 177
def wirings
@outputs + @pendings + @deletes
end
|