Class: JunglePath::Query::Filter
- Inherits:
-
Object
- Object
- JunglePath::Query::Filter
- Defined in:
- lib/jungle_path/query/filter.rb
Instance Attribute Summary collapse
-
#not_in ⇒ Object
readonly
Returns the value of attribute not_in.
-
#pk_filter_query ⇒ Object
readonly
Returns the value of attribute pk_filter_query.
-
#table_name ⇒ Object
readonly
Returns the value of attribute table_name.
Instance Method Summary collapse
- #fk_in_query(table_alias, fk_column_name) ⇒ Object
-
#initialize(table_name, pk_filter_query, not_in = false) ⇒ Filter
constructor
A new instance of Filter.
- #to_h ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(table_name, pk_filter_query, not_in = false) ⇒ Filter
Returns a new instance of Filter.
11 12 13 14 15 |
# File 'lib/jungle_path/query/filter.rb', line 11 def initialize table_name, pk_filter_query, not_in=false @table_name = table_name.to_sym @pk_filter_query = pk_filter_query @not_in = not_in end |
Instance Attribute Details
#not_in ⇒ Object (readonly)
Returns the value of attribute not_in.
10 11 12 |
# File 'lib/jungle_path/query/filter.rb', line 10 def not_in @not_in end |
#pk_filter_query ⇒ Object (readonly)
Returns the value of attribute pk_filter_query.
10 11 12 |
# File 'lib/jungle_path/query/filter.rb', line 10 def pk_filter_query @pk_filter_query end |
#table_name ⇒ Object (readonly)
Returns the value of attribute table_name.
10 11 12 |
# File 'lib/jungle_path/query/filter.rb', line 10 def table_name @table_name end |
Instance Method Details
#fk_in_query(table_alias, fk_column_name) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/jungle_path/query/filter.rb', line 17 def fk_in_query table_alias, fk_column_name if @not_in "#{table_alias}.#{fk_column_name} not in (#{@pk_filter_query})" else "#{table_alias}.#{fk_column_name} in (#{@pk_filter_query})" end end |
#to_h ⇒ Object
29 30 31 |
# File 'lib/jungle_path/query/filter.rb', line 29 def to_h to_hash end |
#to_hash ⇒ Object
25 26 27 |
# File 'lib/jungle_path/query/filter.rb', line 25 def to_hash {table_name: @table_name, pk_filter_query: @pk_filter_query, not_in: @not_in} end |