Class: Ruby2Faust::Program

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby2faust/dsl.rb

Overview

Program-level metadata for Faust declarations

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(process = nil, &block) ⇒ Program

Returns a new instance of Program.



1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
# File 'lib/ruby2faust/dsl.rb', line 1277

def initialize(process = nil, &block)
  @declarations = {}
  @imports = ["stdfaust.lib"]
  if block_given?
    extend DSL
    @process = instance_eval(&block)
  else
    @process = process
  end
end

Instance Attribute Details

#declarationsObject (readonly)

Returns the value of attribute declarations.



1275
1276
1277
# File 'lib/ruby2faust/dsl.rb', line 1275

def declarations
  @declarations
end

#importsObject (readonly)

Returns the value of attribute imports.



1275
1276
1277
# File 'lib/ruby2faust/dsl.rb', line 1275

def imports
  @imports
end

#processObject (readonly)

Returns the value of attribute process.



1275
1276
1277
# File 'lib/ruby2faust/dsl.rb', line 1275

def process
  @process
end

Instance Method Details

#declare(key, value) ⇒ Object



1288
1289
1290
1291
# File 'lib/ruby2faust/dsl.rb', line 1288

def declare(key, value)
  @declarations[key] = value
  self
end

#import(lib) ⇒ Object



1293
1294
1295
1296
# File 'lib/ruby2faust/dsl.rb', line 1293

def import(lib)
  @imports << lib unless @imports.include?(lib)
  self
end