Sha256: 1904e8a463911fcf49ea0e2d019b8261dce0632cea005486868f8eddf424e38d

Contents?: true

Size: 509 Bytes

Versions: 10

Compression:

Stored size: 509 Bytes

Contents

module Flipper
  class Expression
    # Public: A constant value like a "string", Number (1, 3.5), Boolean (true, false).
    #
    # Implements the same interface as Expression
    class Constant
      include Expression::Builder

      attr_reader :value

      def initialize(value)
        @value = value
      end

      def evaluate(_ = nil)
        value
      end

      def eql?(other)
        other.is_a?(self.class) && other.value == value
      end
      alias_method :==, :eql?
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
flipper-1.3.2 lib/flipper/expression/constant.rb
flipper-1.3.1 lib/flipper/expression/constant.rb
flipper-1.3.0 lib/flipper/expression/constant.rb
flipper-1.3.0.pre lib/flipper/expression/constant.rb
flipper-1.2.2 lib/flipper/expression/constant.rb
flipper-1.2.1 lib/flipper/expression/constant.rb
flipper-1.2.0 lib/flipper/expression/constant.rb
flipper-1.1.2 lib/flipper/expression/constant.rb
flipper-1.1.1 lib/flipper/expression/constant.rb
flipper-1.1.0 lib/flipper/expression/constant.rb