class Get::Builders::JoinBuilder

Attributes

base_table[R]
join_table[R]

Public Class Methods

new(options) click to toggle source
Calls superclass method Get::Builders::BaseBuilder::new
# File lib/get/builders/join_builder.rb, line 24
def initialize(options)
  @options = options.merge(with: self.class.join_table)
  super(query_params)
end

Private Instance Methods

class_args() click to toggle source
# File lib/get/builders/join_builder.rb, line 6
def class_args
  {
    base_table: @result_entity.symbolize,
    join_table: @key,
    store: Get.adapter.context_for_entity(@result_entity.singularize)
  }
end
query_params() click to toggle source
# File lib/get/builders/join_builder.rb, line 31
def query_params
  { join: @options }
end
template_class(args) click to toggle source
# File lib/get/builders/join_builder.rb, line 14
def template_class(args)
  Class.new(::Get::Db) do
    include Get

    class << self
      attr_reader :base_table, :join_table
    end

    @base_table, @join_table, @store = args[:base_table], args[:join_table], args[:store]

    def initialize(options)
      @options = options.merge(with: self.class.join_table)
      super(query_params)
    end

    private

    def query_params
      { join: @options }
    end
  end
end