class Flowckerc::SolverClass::FormulaExecContext
Attributes
options[R]
syms[R]
Public Class Methods
new(syms, molecule, molecule_ports, options)
click to toggle source
# File lib/flowckerc.rb, line 164 def initialize syms, molecule, molecule_ports, options @syms = syms @molecule = molecule @molecule_ports = molecule_ports @options = options end
Public Instance Methods
atom(element, &blk)
click to toggle source
# File lib/flowckerc.rb, line 171 def atom element, &blk atom = Atom.new element @molecule.atoms.push atom AtomExecContext.new(atom, self).instance_exec &blk end
inport(name, to_atom, to_port)
click to toggle source
# File lib/flowckerc.rb, line 181 def inport name, to_atom, to_port @molecule_ports.inports.push name: name, to_atom: to_atom, to_port: to_port end
link(spec={})
click to toggle source
# File lib/flowckerc.rb, line 177 def link spec={} @molecule.links.push Link.new spec[:from][0], spec[:from][1], spec[:to][0], spec[:to][1] end
mix(formula_file, name, options={})
click to toggle source
# File lib/flowckerc.rb, line 193 def mix formula_file, name, options={} formula = Formula.new formula_file solution = Solver.solve formula, options @molecule.atoms += solution.molecule.atoms @molecule.links += solution.molecule.links @syms.add name, solution end
outport(name, from_atom, from_port)
click to toggle source
# File lib/flowckerc.rb, line 187 def outport name, from_atom, from_port @molecule_ports.outports.push name: name, from_atom: from_atom, from_port: from_port end