Class: Drillbit::Parameters::Filter

Inherits:
Object
  • Object
show all
Defined in:
lib/drillbit/parameters/filter.rb

Constant Summary collapse

NUMERICAL =
/[\d_\.]+?/
ISO8601 =
/\d{4}-\d{2}-\d{2}T\d{2}\:\d{2}\:\d{2}(?:[+-]\d{2}\:\d{2}|Z)/
NUMERICAL_RANGE =
/\A(#{NUMERICAL})\.\.\.?(#{NUMERICAL}|Infinity)\z/
DATE_RANGE =
/\A(#{ISO8601})\.\.\.?(#{ISO8601})\z/

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw_parameters) ⇒ Filter

Returns a new instance of Filter.



13
14
15
# File 'lib/drillbit/parameters/filter.rb', line 13

def initialize(raw_parameters)
  self.raw_parameters = raw_parameters || {}
end

Instance Attribute Details

#raw_parametersObject

Returns the value of attribute raw_parameters.



11
12
13
# File 'lib/drillbit/parameters/filter.rb', line 11

def raw_parameters
  @raw_parameters
end

Instance Method Details

#each_with_object(memoized) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/drillbit/parameters/filter.rb', line 21

def each_with_object(memoized)
  compacted_parameters.each do |name, value|
    memoized = yield name, format_value(value), memoized
  end

  memoized
end

#present?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/drillbit/parameters/filter.rb', line 17

def present?
  compacted_parameters.any?
end