Class: Selector::Function
- Defined in:
- lib/selector/function.rb
Overview
The condition checks if the function returns truthy result for a value
Instance Attribute Summary
Attributes inherited from Condition
Instance Method Summary collapse
-
#[](value) ⇒ Boolean
Checks if the function returns truthy for value.
-
#initialize(function) ⇒ Function
constructor
Initializes the condition with a function.
Methods inherited from Condition
#!, #&, #-, #==, #attribute, #|
Constructor Details
#initialize(function) ⇒ Function
Initializes the condition with a function
16 17 18 |
# File 'lib/selector/function.rb', line 16 def initialize(_) super end |
Instance Method Details
#[](value) ⇒ Boolean
Checks if the function returns truthy for value
31 32 33 |
# File 'lib/selector/function.rb', line 31 def [](value) attribute.call(value) ? true : false end |