class Nodus::Nodes::Node

I think we’ll want the following to be completely disjoint: (common methods) ⊔ (node methods) ⊔ (parameter names) ⊔ (node names) ⊔ (stream-port names) This way we can do method_missing safely to specify params, nodes, ports, or anything else depending on the context.

TODO: make nodes aware of their container? in order, perhaps, for them to ask the container who they should be connected to instead of the other way around?

Public Class Methods

[](*args, &block)
Alias for: compose
compose(*args, &block) click to toggle source
# File lib/nodus/nodes.rb, line 57
def compose(*args, &block)
  Class.new(self) do |new_klass|
    new_klass.on_compose(*args)
    new_klass.instance_exec(new_klass, &block) if block_given?
  end
end
Also aliased as: []
kind_of_node?() click to toggle source
# File lib/nodus/nodes.rb, line 50
def kind_of_node?()    true end
new(*params) click to toggle source

Initialize will usually allow any parameters (/parameter overrides), and any object-level connection information required.

# File lib/nodus/nodes.rb, line 82
def initialize(*params)
  # fill params with non-hash heads of args and then use any remaining hash to fill in more params
  # runtime error if some required parameters are not set
end
on_compose(title) click to toggle source

Override this at will with whatever parameters you want- just remember to call super, and with the right parameters

# File lib/nodus/nodes.rb, line 67
def on_compose(title)
  error ArgumentError, "First argument to compose needs to be the symbolic title, not `#{title.inspect}`" unless title.kind_of? Symbol
  self.title = title
end
param(param_name, *args) click to toggle source
# File lib/nodus/nodes.rb, line 51
def param(param_name, *args)
  arg_hash = (Hash === args.last ? args.pop : {})
  arg_hash.merge!({name: param_name, node: self.title, node_type: self, node_name: self.name})
  parameters << [param_name, args << arg_hash]
end