Class: ParamsReady::Helpers::ArelBuilder::Table
- Inherits:
-
Object
- Object
- ParamsReady::Helpers::ArelBuilder::Table
show all
- Defined in:
- lib/params_ready/helpers/arel_builder.rb
Defined Under Namespace
Classes: Callable, Literal
Class Method Summary
collapse
Class Method Details
.instance(object, table_alias: nil) ⇒ Object
90
91
92
93
94
95
96
97
98
99
100
101
102
|
# File 'lib/params_ready/helpers/arel_builder.rb', line 90
def self.instance(object, table_alias: nil)
case object
when Arel::Table, Arel::Nodes::TableAlias
raise ParamsReadyError, "Table alias unexpected" unless table_alias.nil?
ArelObject.new(object)
when Proc
Callable.new(object, table_alias)
when String, Symbol
Literal.new(object, table_alias)
else
raise ParamsReadyError, "Unexpected type for arel builder: #{object.class.name}"
end
end
|