Class: NRSER::Types::Where
Instance Attribute Summary collapse
-
#predicate ⇒ Object
readonly
Returns the value of attribute predicate.
Instance Method Summary collapse
-
#initialize(predicate, **options) ⇒ Where
constructor
A new instance of Where.
- #test(value) ⇒ Object
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, ** super ** @predicate = predicate end |
Instance Attribute Details
#predicate ⇒ Object (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 |