Sha256: bc696a464787d704c45427cd8281b9805305d36a287329e4924b8f3b47b3188d

Contents?: true

Size: 782 Bytes

Versions: 7

Compression:

Stored size: 782 Bytes

Contents

module Solve
  class Solver
    class VariableRow
      attr_reader :artifact
      attr_reader :value
      attr_reader :sources

      # @param [String] artifact
      # @param [String, Symbol] source
      def initialize(artifact, source)
        @artifact = artifact
        @value = nil
        @sources = Array(source)
      end

      # @param [String, Symbol] source
      def add_source(source)
        @sources << source
      end

      def last_source
        @sources.last
      end

      def bind(value)
        @value = value
      end

      def unbind
        @value = nil
      end

      def bound?
        !@value.nil?
      end

      # @param [String, Symbol] source
      def remove_source(source)
        @sources.delete(source)
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
solve-0.8.2 lib/solve/solver/variable_row.rb
solve-0.8.1 lib/solve/solver/variable_row.rb
solve-0.8.0 lib/solve/solver/variable_row.rb
solve-0.7.0 lib/solve/solver/variable_row.rb
solve-0.6.1 lib/solve/solver/variable_row.rb
solve-0.6.0 lib/solve/solver/variable_row.rb
solve-0.5.0 lib/solve/solver/variable_row.rb