Class: ParamsReady::Helpers::ArelBuilder::Callable
- Inherits:
-
Object
- Object
- ParamsReady::Helpers::ArelBuilder::Callable
show all
- Defined in:
- lib/params_ready/helpers/arel_builder.rb
Instance Method Summary
collapse
Constructor Details
#initialize(proc) ⇒ Callable
Returns a new instance of Callable.
7
8
9
|
# File 'lib/params_ready/helpers/arel_builder.rb', line 7
def initialize(proc)
@proc = proc
end
|
Instance Method Details
#to_arel(*args) ⇒ Object
11
12
13
14
15
16
17
18
19
|
# File 'lib/params_ready/helpers/arel_builder.rb', line 11
def to_arel(*args)
result = @proc.call(*args)
case result
when String, Symbol
to_literal(result).to_arel(*args)
else
result
end
end
|
#to_literal ⇒ Object
21
22
23
|
# File 'lib/params_ready/helpers/arel_builder.rb', line 21
def to_literal(*)
raise ParamsReadyError, "Unimplemented: #{self.class.name}##{__callee__}"
end
|