Class: Squeel::Nodes::Function

Inherits:
Object
  • Object
show all
Includes:
Operators, PredicateMethods
Defined in:
lib/squeel/nodes/function.rb

Direct Known Subclasses

Operation

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Operators

#*, #+, #-, #/, #op

Methods included from PredicateMethods

included

Constructor Details

#initialize(name, args) ⇒ Function

Returns a new instance of Function.



12
13
14
# File 'lib/squeel/nodes/function.rb', line 12

def initialize(name, args)
  @name, @args = name, args
end

Instance Attribute Details

#aliasObject (readonly)

Returns the value of attribute alias.



10
11
12
# File 'lib/squeel/nodes/function.rb', line 10

def alias
  @alias
end

#argsObject (readonly)

Returns the value of attribute args.



10
11
12
# File 'lib/squeel/nodes/function.rb', line 10

def args
  @args
end

#nameObject (readonly)

Returns the value of attribute name.



10
11
12
# File 'lib/squeel/nodes/function.rb', line 10

def name
  @name
end

Instance Method Details

#<(value) ⇒ Object



67
68
69
# File 'lib/squeel/nodes/function.rb', line 67

def <(value)
  Predicate.new self, :lt, value
end

#<<(value) ⇒ Object



46
47
48
# File 'lib/squeel/nodes/function.rb', line 46

def <<(value)
  Predicate.new self, :not_in, value
end

#<=(value) ⇒ Object



71
72
73
# File 'lib/squeel/nodes/function.rb', line 71

def <=(value)
  Predicate.new self, :lteq, value
end

#==(value) ⇒ Object



21
22
23
# File 'lib/squeel/nodes/function.rb', line 21

def ==(value)
  Predicate.new self, :eq, value
end

#=~(value) ⇒ Object



50
51
52
# File 'lib/squeel/nodes/function.rb', line 50

def =~(value)
  Predicate.new self, :matches, value
end

#>(value) ⇒ Object



59
60
61
# File 'lib/squeel/nodes/function.rb', line 59

def >(value)
  Predicate.new self, :gt, value
end

#>=(value) ⇒ Object



63
64
65
# File 'lib/squeel/nodes/function.rb', line 63

def >=(value)
  Predicate.new self, :gteq, value
end

#>>(value) ⇒ Object



42
43
44
# File 'lib/squeel/nodes/function.rb', line 42

def >>(value)
  Predicate.new self, :in, value
end

#^(value) ⇒ Object



38
39
40
# File 'lib/squeel/nodes/function.rb', line 38

def ^(value)
  Predicate.new self, :not_eq, value
end

#as(alias_name) ⇒ Object



16
17
18
19
# File 'lib/squeel/nodes/function.rb', line 16

def as(alias_name)
  @alias = alias_name.to_s
  self
end

#ascObject



25
26
27
# File 'lib/squeel/nodes/function.rb', line 25

def asc
  Order.new self, 1
end

#descObject



29
30
31
# File 'lib/squeel/nodes/function.rb', line 29

def desc
  Order.new self, -1
end

#to_symObject

expand_hash_conditions_for_aggregates assumes our hash keys can be converted to symbols, so this has to be implemented, but it doesn’t really have to do anything useful.



78
79
80
# File 'lib/squeel/nodes/function.rb', line 78

def to_sym
  nil
end