Class: Pipe::Filter::JSONContains

Inherits:
Object
  • Object
show all
Defined in:
lib/pipe/filter/json_contains.rb

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ JSONContains

Returns a new instance of JSONContains.



2
3
4
# File 'lib/pipe/filter/json_contains.rb', line 2

def initialize(options)
  @options = options
end

Instance Method Details

#match?(object) ⇒ Boolean

Returns:

  • (Boolean)


6
7
8
9
# File 'lib/pipe/filter/json_contains.rb', line 6

def match?(object)
  match = object[@options[:attribute]] =~ /#{@options[:contains]}/
  match and match >= 0
end