Sha256: bd9fcdba86a5628b026c88d9af33df4c55f17056c5833788ec28bb0b65f297d8

Contents?: true

Size: 706 Bytes

Versions: 34

Compression:

Stored size: 706 Bytes

Contents

# frozen_string_literal: true

module Quby
  module Compiler
    module Entities
      class ScoreCalculation
        attr_accessor :key, :label, :sbg_key, :options, :calculation

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

        def score
          @options[:score]
        end

        def completion
          @options[:completion]
        end

        def action
          @options[:action]
        end

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

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
quby-compiler-0.5.9 lib/quby/compiler/entities/score_calculation.rb
quby-compiler-0.5.8 lib/quby/compiler/entities/score_calculation.rb
quby-compiler-0.5.7 lib/quby/compiler/entities/score_calculation.rb
quby-compiler-0.5.6 lib/quby/compiler/entities/score_calculation.rb
quby-compiler-0.5.5 lib/quby/compiler/entities/score_calculation.rb
quby-compiler-0.5.4 lib/quby/compiler/entities/score_calculation.rb
quby-compiler-0.5.3 lib/quby/compiler/entities/score_calculation.rb
quby-compiler-0.5.2 lib/quby/compiler/entities/score_calculation.rb
quby-compiler-0.5.1 lib/quby/compiler/entities/score_calculation.rb
quby-compiler-0.5.0 lib/quby/compiler/entities/score_calculation.rb
quby-compiler-0.4.16 lib/quby/compiler/entities/score_calculation.rb
quby-compiler-0.4.15 lib/quby/compiler/entities/score_calculation.rb
quby-compiler-0.4.14 lib/quby/compiler/entities/score_calculation.rb
quby-compiler-0.4.13 lib/quby/compiler/entities/score_calculation.rb
quby-compiler-0.4.12 lib/quby/compiler/entities/score_calculation.rb
quby-compiler-0.4.11 lib/quby/compiler/entities/score_calculation.rb
quby-compiler-0.4.10 lib/quby/compiler/entities/score_calculation.rb
quby-compiler-0.4.9 lib/quby/compiler/entities/score_calculation.rb
quby-compiler-0.4.8 lib/quby/compiler/entities/score_calculation.rb
quby-compiler-0.4.7 lib/quby/compiler/entities/score_calculation.rb