Class: Crowbar::Client::Filter::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/crowbar/client/filter/base.rb

Overview

Base that provides methods shared between different filters

Direct Known Subclasses

Array, Hash, Subset

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Base

Returns a new instance of Base.



26
27
28
# File 'lib/crowbar/client/filter/base.rb', line 26

def initialize(options = {})
  self.options = options
end

Instance Attribute Details

#optionsObject

Returns the value of attribute options.



24
25
26
# File 'lib/crowbar/client/filter/base.rb', line 24

def options
  @options
end

Instance Method Details

#processObject

Raises:



38
39
40
# File 'lib/crowbar/client/filter/base.rb', line 38

def process
  raise BadFilterError
end

#resultObject



30
31
32
33
34
35
36
# File 'lib/crowbar/client/filter/base.rb', line 30

def result
  if options[:filter].present?
    process
  else
    options[:values]
  end
end