Class: Poisson::Query

Inherits:
Object
  • Object
show all
Defined in:
lib/poisson/query.rb

Overview

You send queries to an instance of this class in the block from the Poisson#probability method. There is no need to instantiate it directly.

There are a number of different operators you can use. Note that only == accepts Ranges:

==

Equal to. Accepts:

  • Integers: x == 5

  • Ranges: x == (5..9) - This is the equivalent of saying “5 <= x <= 9”

not_eql

Not equal to

<=

Less than or equal to

>=

Greater than or equal to

<

Less than

>

Greater than

Defined Under Namespace

Classes: InvalidQuery

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#conditionObject

:nodoc:



20
21
22
# File 'lib/poisson/query.rb', line 20

def condition
  @condition
end

#valueObject

:nodoc:



20
21
22
# File 'lib/poisson/query.rb', line 20

def value
  @value
end

Instance Method Details

#==(value) ⇒ Object

:nodoc:



29
30
31
32
# File 'lib/poisson/query.rb', line 29

def == value # :nodoc:
  validate_value value, true
  @condition, @value = :==, value
end