Module: AudioDicer

Defined in:
lib/audio_dicer.rb,
lib/audio_dicer/runner.rb,
lib/audio_dicer/context.rb,
lib/audio_dicer/version.rb,
lib/audio_dicer/context/album.rb

Defined Under Namespace

Classes: Context, Runner

Constant Summary collapse

VERSION =
"0.1.0"

Class Method Summary collapse

Class Method Details

.execute(script, filename = nil) ⇒ Object



18
19
20
21
22
23
# File 'lib/audio_dicer.rb', line 18

def self.execute(script, filename = nil)
  ctx = Context.new
  ctx.instance_eval script

  Runner.new(ctx).run
end

.expand_relative_file(file) ⇒ Object



8
9
10
# File 'lib/audio_dicer.rb', line 8

def self.expand_relative_file(file)
  File.expand_path(file, Dir.pwd)
end

.load(filename) ⇒ Object



12
13
14
15
16
# File 'lib/audio_dicer.rb', line 12

def self.load(filename)
  File.open(expand_relative_file(filename)) do |file|
    execute file.read, filename
  end
end