Class: Musicality::ScoreDSL

Inherits:
Object
  • Object
show all
Defined in:
lib/musicality/composition/dsl/score_dsl.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeScoreDSL

Returns a new instance of ScoreDSL.



11
12
13
# File 'lib/musicality/composition/dsl/score_dsl.rb', line 11

def initialize
  @score = nil
end

Instance Attribute Details

#scoreObject (readonly)

Returns the value of attribute score.



10
11
12
# File 'lib/musicality/composition/dsl/score_dsl.rb', line 10

def score
  @score
end

Class Method Details

.load(fname) ⇒ Object



4
5
6
7
8
# File 'lib/musicality/composition/dsl/score_dsl.rb', line 4

def self.load fname
  dsl = ScoreDSL.new
  dsl.instance_eval(File.read(fname), fname)
  dsl
end

Instance Method Details

#tempo_score(start_tempo, &block) ⇒ Object



15
16
17
18
# File 'lib/musicality/composition/dsl/score_dsl.rb', line 15

def tempo_score start_tempo, &block
  @score = Score::Tempo.new(start_tempo)
  @score.instance_eval(&block)
end