Class: NRSER::Types::Where

Inherits:
Type
  • Object
show all
Defined in:
lib/nrser/types/where.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Type

#check, #default_name, #from_data, #from_s, #has_from_data?, #has_from_s?, #has_to_data?, #name, #respond_to?, short_name, #to_data, #to_s

Constructor Details

#initialize(predicate, **options) ⇒ Where

Returns a new instance of Where.



8
9
10
11
# File 'lib/nrser/types/where.rb', line 8

def initialize predicate, **options
  super **options
  @predicate = predicate
end

Instance Attribute Details

#predicateObject (readonly)

Returns the value of attribute predicate.



6
7
8
# File 'lib/nrser/types/where.rb', line 6

def predicate
  @predicate
end

Instance Method Details

#test(value) ⇒ Object



13
14
15
# File 'lib/nrser/types/where.rb', line 13

def test value
  !!@predicate.call(value)
end