Class: Lafcadio::Query::Inferrer

Inherits:
Object
  • Object
show all
Defined in:
lib/lafcadio/query.rb

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initialize(*args, &action) ⇒ Inferrer

Returns a new instance of Inferrer.



601
602
603
604
605
606
607
608
609
# File 'lib/lafcadio/query.rb', line 601

def initialize( *args, &action )
	@domain_class = args.first; @action = action
	unless args.size == 1
		h = args.last
		@order_by = h[:order_by]
		@order_by_order = ( h[:order_by_order] or :asc )
		@limit = h[:limit]
	end
end

Instance Method Details

#executeObject



611
612
613
614
615
616
617
618
619
# File 'lib/lafcadio/query.rb', line 611

def execute
	impostor = DomainObjectImpostor.impostor @domain_class
	condition = @action.call( impostor ).to_condition
	query = Query.new( @domain_class, :condition => condition )
	query.order_by = @order_by
	query.order_by_order = @order_by_order
	query.limit = @limit
	query
end