Class: Ruby2Faust::Node
- Inherits:
-
Struct
- Object
- Struct
- Ruby2Faust::Node
- Defined in:
- lib/ruby2faust/ir.rb
Overview
Intermediate Representation node for DSP graphs. Nodes are immutable value objects representing DSP operations.
Instance Attribute Summary collapse
-
#args ⇒ Object
Returns the value of attribute args.
-
#channels ⇒ Object
Returns the value of attribute channels.
-
#inputs ⇒ Object
Returns the value of attribute inputs.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
- #fingerprint ⇒ Object
-
#initialize(type:, args: [], inputs: [], channels: 1) ⇒ Node
constructor
A new instance of Node.
- #same_structure?(other) ⇒ Boolean
Constructor Details
#initialize(type:, args: [], inputs: [], channels: 1) ⇒ Node
Returns a new instance of Node.
9 10 11 |
# File 'lib/ruby2faust/ir.rb', line 9 def initialize(type:, args: [], inputs: [], channels: 1) super(type: type, args: args.freeze, inputs: inputs.freeze, channels: channels) end |
Instance Attribute Details
#args ⇒ Object
Returns the value of attribute args
8 9 10 |
# File 'lib/ruby2faust/ir.rb', line 8 def args @args end |
#channels ⇒ Object
Returns the value of attribute channels
8 9 10 |
# File 'lib/ruby2faust/ir.rb', line 8 def channels @channels end |
#inputs ⇒ Object
Returns the value of attribute inputs
8 9 10 |
# File 'lib/ruby2faust/ir.rb', line 8 def inputs @inputs end |
#type ⇒ Object
Returns the value of attribute type
8 9 10 |
# File 'lib/ruby2faust/ir.rb', line 8 def type @type end |
Instance Method Details
#fingerprint ⇒ Object
13 14 15 16 |
# File 'lib/ruby2faust/ir.rb', line 13 def fingerprint content = [type, args, inputs.map(&:fingerprint)].inspect Digest::SHA1.hexdigest(content) end |
#same_structure?(other) ⇒ Boolean
18 19 20 |
# File 'lib/ruby2faust/ir.rb', line 18 def same_structure?(other) fingerprint == other.fingerprint end |