Module: DaruLite::Vector::Queryable
- Included in:
- DaruLite::Vector
- Defined in:
- lib/daru_lite/vector/queryable.rb
Instance Method Summary collapse
- #all? ⇒ Boolean
- #any? ⇒ Boolean
- #empty? ⇒ Boolean
-
#include_values?(*values) ⇒ true, false
Check if any one of mentioned values occur in the vector.
-
#match(regexp) ⇒ Array
Returns an array of either none or integer values, indicating the
regexpmatching with the given array.
Instance Method Details
#all? ⇒ Boolean
24 25 26 |
# File 'lib/daru_lite/vector/queryable.rb', line 24 def all?(&) @data.data.all?(&) end |
#any? ⇒ Boolean
20 21 22 |
# File 'lib/daru_lite/vector/queryable.rb', line 20 def any?(&) @data.data.any?(&) end |
#empty? ⇒ Boolean
4 5 6 |
# File 'lib/daru_lite/vector/queryable.rb', line 4 def empty? @index.empty? end |
#include_values?(*values) ⇒ true, false
Check if any one of mentioned values occur in the vector
16 17 18 |
# File 'lib/daru_lite/vector/queryable.rb', line 16 def include_values?(*values) values.any? { |v| include_with_nan? @data, v } end |
#match(regexp) ⇒ Array
Returns an array of either none or integer values, indicating the regexp matching with the given array.
40 41 42 |
# File 'lib/daru_lite/vector/queryable.rb', line 40 def match(regexp) @data.map { |value| !!(value =~ regexp) } end |