Class: ParamsReady::Query::CustomPredicateBuilder

Inherits:
Builder show all
Includes:
AbstractPredicateBuilder::HavingType
Defined in:
lib/params_ready/query/custom_predicate.rb

Instance Method Summary collapse

Methods included from AbstractPredicateBuilder::HavingType

#type

Methods inherited from Builder

#helper

Methods inherited from AbstractBuilder

#build, builder, define_parameter, define_registered_parameter, #fetch, fetch_builder, #include, instance, #open?, register, register_deprecated, resolve

Methods included from Extensions::Registry

#human_string, #registry

Constructor Details

#initialize(name, altn: nil) ⇒ CustomPredicateBuilder

Returns a new instance of CustomPredicateBuilder.



52
53
54
# File 'lib/params_ready/query/custom_predicate.rb', line 52

def initialize(name, altn: nil)
  super CustomPredicateDefinition.new(name, altn: altn)
end

Instance Method Details

#data_object_handlesObject



61
62
63
# File 'lib/params_ready/query/custom_predicate.rb', line 61

def data_object_handles
  [@definition.name, @definition.altn]
end

#eligible(&proc) ⇒ Object



69
70
71
# File 'lib/params_ready/query/custom_predicate.rb', line 69

def eligible(&proc)
  @definition.set_eligibility_test(proc)
end

#test(&proc) ⇒ Object



73
74
75
# File 'lib/params_ready/query/custom_predicate.rb', line 73

def test(&proc)
  @definition.set_test(proc)
end

#to_query(&proc) ⇒ Object



65
66
67
# File 'lib/params_ready/query/custom_predicate.rb', line 65

def to_query(&proc)
  @definition.set_to_query(proc)
end

#type_builder_instance(type_name, name, *args, altn:, **opts, &block) ⇒ Object



56
57
58
59
# File 'lib/params_ready/query/custom_predicate.rb', line 56

def type_builder_instance(type_name, name, *args, altn:, **opts, &block)
  builder_class = Builder.builder(type_name)
  builder_class.instance(name, *args, altn: altn, **opts)
end