Class: Flipper::Expression::Constant

Inherits:
Object
  • Object
show all
Includes:
Builder
Defined in:
lib/flipper/expression/constant.rb

Overview

Public: A constant value like a “string”, Number (1, 3.5), Boolean (true, false).

Implements the same interface as Expression

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Builder

#add, #all, #all?, #any, #any?, #build, #equal, #greater_than, #greater_than_or_equal_to, #group?, #less_than, #less_than_or_equal_to, #not_equal, #percentage_of_actors, #remove

Constructor Details

#initialize(value) ⇒ Constant

Returns a new instance of Constant.



11
12
13
# File 'lib/flipper/expression/constant.rb', line 11

def initialize(value)
  @value = value
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



9
10
11
# File 'lib/flipper/expression/constant.rb', line 9

def value
  @value
end

Instance Method Details

#eql?(other) ⇒ Boolean Also known as: ==

Returns:

  • (Boolean)


19
20
21
# File 'lib/flipper/expression/constant.rb', line 19

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

#evaluate(_ = nil) ⇒ Object



15
16
17
# File 'lib/flipper/expression/constant.rb', line 15

def evaluate(_ = nil)
  value
end