Class: Selector::Regexp
Overview
The condition checks if a value matches the regexp
Instance Attribute Summary
Attributes inherited from Condition
Instance Method Summary collapse
-
#[](value) ⇒ Boolean
Checks if the stringified value matches the regexp.
-
#initialize(regexp) ⇒ Regexp
constructor
Initializes the condition with the regexp.
-
#|(other) ⇒ Object
Creates an OR composition.
Methods inherited from Condition
#!, #&, #-, #==, #attribute
Constructor Details
#initialize(regexp) ⇒ Regexp
Initializes the condition with the regexp
16 17 18 |
# File 'lib/selector/regexp.rb', line 16 def initialize(_) super end |
Instance Method Details
#[](value) ⇒ Boolean
Checks if the stringified value matches the regexp
31 32 33 |
# File 'lib/selector/regexp.rb', line 31 def [](value) value.to_s[attribute] ? true : false end |