Class: ROM::SQL::Function Private

Inherits:
ROM::Schema::Attribute
  • Object
show all
Defined in:
lib/rom/sql/function.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth, *args) ⇒ Object (private)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



35
36
37
38
39
40
41
42
43
44
45
# File 'lib/rom/sql/function.rb', line 35

def method_missing(meth, *args)
  if func
    if func.respond_to?(meth)
      meta(func: func.__send__(meth, *args))
    else
      super
    end
  else
    meta(func: Sequel::SQL::Function.new(meth.to_s.upcase, *args))
  end
end

Instance Method Details

#is(other) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



25
26
27
# File 'lib/rom/sql/function.rb', line 25

def is(other)
  ::Sequel::SQL::BooleanExpression.new(:'=', func, other)
end

#nameObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



15
16
17
# File 'lib/rom/sql/function.rb', line 15

def name
  meta[:alias] || super
end

#qualifiedObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



19
20
21
22
23
# File 'lib/rom/sql/function.rb', line 19

def qualified
  meta(
    func: ::Sequel::SQL::Function.new(func.name, *func.args.map { |arg| arg.respond_to?(:qualified) ? arg.qualified : arg })
  )
end

#sql_literal(ds) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



7
8
9
10
11
12
13
# File 'lib/rom/sql/function.rb', line 7

def sql_literal(ds)
  if name
    func.as(name).sql_literal(ds)
  else
    func.sql_literal(ds)
  end
end