class Selector::Function
The condition checks if the function returns truthy result for a value
@example (see []
)
Public Class Methods
new(_)
click to toggle source
@!method initialize(function) Initializes the condition with a function
@param [#call] function
Calls superclass method
Selector::Condition::new
# File lib/selector/function.rb, line 16 def initialize(_) super end
Public Instance Methods
[](value)
click to toggle source
Checks if the function returns truthy for value
@example
condition = Selector::Function.new -> v { v[/foo/] } condition[:foo] # => true condition[:bar] # => false
@param (see Selector::Condition#[]
)
@return (see Selector::Condition#[]
)
# File lib/selector/function.rb, line 31 def [](value) attribute.call(value) ? true : false end