class JunglePath::Query::Filter

Attributes

not_in[R]
pk_filter_query[R]
table_name[R]

Public Class Methods

new(table_name, pk_filter_query, not_in=false) click to toggle source
# 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

Public Instance Methods

fk_in_query(table_alias, fk_column_name) click to toggle source
# 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() click to toggle source
# File lib/jungle_path/query/filter.rb, line 29
def to_h
  to_hash
end
to_hash() click to toggle source
# 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