Class: ParamsReady::Query::ExistsPredicateBuilder
Class Method Summary
collapse
Instance Method Summary
collapse
#add
Methods inherited from Builder
#helper
#build, builder, define_parameter, define_registered_parameter, #fetch, fetch_builder, #include, #initialize, #open?, register, register_deprecated, resolve
#human_string, #registry
Class Method Details
.instance(name, altn: nil, coll: nil) ⇒ Object
64
65
66
|
# File 'lib/params_ready/query/exists_predicate.rb', line 64
def self.instance(name, altn: nil, coll: nil)
new ExistsPredicateDefinition.new(name, altn: altn, path_to_collection: Array(coll))
end
|
Instance Method Details
#existence(&block) ⇒ Object
77
78
79
80
81
82
83
|
# File 'lib/params_ready/query/exists_predicate.rb', line 77
def existence(&block)
definition = Builder.define_symbol(:existence, altn: :ex) do
constrain :enum, [:some, :none]
include &block
end
add definition
end
|
#outer_table(arel_table) ⇒ Object
73
74
75
|
# File 'lib/params_ready/query/exists_predicate.rb', line 73
def outer_table(arel_table)
@definition.set_outer_table arel_table
end
|
68
69
70
71
|
# File 'lib/params_ready/query/exists_predicate.rb', line 68
def related(on: nil, eq: nil, &block)
join_statement = JoinStatement::Builder.new(on: on, eq: eq, &block)
@definition.set_related(join_statement.build)
end
|