Class: Quby::Compiler::Entities::ScoreCalculation

Inherits:
Object
  • Object
show all
Defined in:
lib/quby/compiler/entities/score_calculation.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key, options, &block) ⇒ ScoreCalculation

Returns a new instance of ScoreCalculation.



9
10
11
12
13
14
15
# File 'lib/quby/compiler/entities/score_calculation.rb', line 9

def initialize(key, options, &block)
  @key = key
  @label = options[:label]
  @sbg_key = options[:sbg_key]
  @options = options
  @calculation = block
end

Instance Attribute Details

#calculationObject

Returns the value of attribute calculation.



7
8
9
# File 'lib/quby/compiler/entities/score_calculation.rb', line 7

def calculation
  @calculation
end

#keyObject

Returns the value of attribute key.



7
8
9
# File 'lib/quby/compiler/entities/score_calculation.rb', line 7

def key
  @key
end

#labelObject

Returns the value of attribute label.



7
8
9
# File 'lib/quby/compiler/entities/score_calculation.rb', line 7

def label
  @label
end

#optionsObject

Returns the value of attribute options.



7
8
9
# File 'lib/quby/compiler/entities/score_calculation.rb', line 7

def options
  @options
end

#sbg_keyObject

Returns the value of attribute sbg_key.



7
8
9
# File 'lib/quby/compiler/entities/score_calculation.rb', line 7

def sbg_key
  @sbg_key
end

Instance Method Details

#actionObject



25
26
27
# File 'lib/quby/compiler/entities/score_calculation.rb', line 25

def action
  @options[:action]
end

#completionObject



21
22
23
# File 'lib/quby/compiler/entities/score_calculation.rb', line 21

def completion
  @options[:completion]
end

#scoreObject



17
18
19
# File 'lib/quby/compiler/entities/score_calculation.rb', line 17

def score
  @options[:score]
end

#sourcecodeObject



29
30
31
# File 'lib/quby/compiler/entities/score_calculation.rb', line 29

def sourcecode
  options[:ruby_string] || calculation&.to_proc&.source
end