Class: Daru::WhichQuery
Defined Under Namespace
Classes: VectorWrapper
Instance Method Summary collapse
- #`(vector_name) ⇒ Object
-
#exec ⇒ Object
executes a block of DSL code.
-
#initialize(df, &condition) ⇒ WhichQuery
constructor
A new instance of WhichQuery.
Constructor Details
#initialize(df, &condition) ⇒ WhichQuery
Returns a new instance of WhichQuery.
21 22 23 24 |
# File 'lib/daru/extensions/which_dsl.rb', line 21 def initialize(df, &condition) @df = df @condition = condition end |
Instance Method Details
#`(vector_name) ⇒ Object
32 33 34 35 36 37 |
# File 'lib/daru/extensions/which_dsl.rb', line 32 def `(vector_name) if !@df.has_vector?(vector_name) && @df.has_vector?(vector_name.to_sym) vector_name = vector_name.to_sym end VectorWrapper.new(@df[vector_name]) end |
#exec ⇒ Object
executes a block of DSL code
27 28 29 30 |
# File 'lib/daru/extensions/which_dsl.rb', line 27 def exec query = instance_eval(&@condition) @df.where(query) end |