Module: Arel
- Defined in:
- lib/arel_extensions/nodes/select.rb,
lib/arel_extensions.rb
Defined Under Namespace
Modules: Nodes
Classes: InsertManager, SelectManager, Table
Class Method Summary
collapse
Class Method Details
.column_of(table_name, column_name) ⇒ Object
97
98
99
|
# File 'lib/arel_extensions.rb', line 97
def self.column_of table_name, column_name
ArelExtensions.column_of(table_name, column_name)
end
|
.duration(s, expr) ⇒ Object
.false ⇒ Object
The FALSE pseudo literal.
106
107
108
|
# File 'lib/arel_extensions.rb', line 106
def self.false
Arel::Nodes::Equality.new(1, 0)
end
|
.grouping(*v) ⇒ Object
110
111
112
|
# File 'lib/arel_extensions.rb', line 110
def self.grouping *v
Arel::Nodes::Grouping.new(*v)
end
|
.json(*expr) ⇒ Object
114
115
116
117
118
119
120
121
122
|
# File 'lib/arel_extensions.rb', line 114
def self.json *expr
ArelExtensions::Nodes::Json.new(
if expr.length == 1
expr.first
else
expr
end
)
end
|
.json_false ⇒ Object
134
135
136
137
138
139
140
141
142
|
# File 'lib/arel_extensions.rb', line 134
def self.json_false
res = Arel.grouping(Arel.quoted('false'))
res.instance_eval {
def return_type
:boolean
end
}
res
end
|
.json_true ⇒ Object
124
125
126
127
128
129
130
131
132
|
# File 'lib/arel_extensions.rb', line 124
def self.json_true
res = Arel.grouping(Arel.quoted('true'))
res.instance_eval {
def return_type
:boolean
end
}
res
end
|
.null ⇒ Object
145
146
147
|
# File 'lib/arel_extensions.rb', line 145
def self.null
Arel.quoted(nil)
end
|
.quoted(*args) ⇒ Object
149
150
151
|
# File 'lib/arel_extensions.rb', line 149
def self.quoted *args
Arel::Nodes.build_quoted(*args)
end
|
.rollup(*args) ⇒ Object
157
158
159
|
# File 'lib/arel_extensions.rb', line 157
def self.rollup(*args)
Arel::Nodes::RollUp.new(args)
end
|
.shorten(s) ⇒ Object
161
162
163
|
# File 'lib/arel_extensions.rb', line 161
def self.shorten s
Base64.urlsafe_encode64(Digest::MD5.new.digest(s)).tr('=', '').tr('-', '_')
end
|
.true ⇒ Object
166
167
168
|
# File 'lib/arel_extensions.rb', line 166
def self.true
Arel::Nodes::Equality.new(1, 1)
end
|
.tuple(*v) ⇒ Object
170
171
172
173
|
# File 'lib/arel_extensions.rb', line 170
def self.tuple *v
tmp = Arel.grouping(nil)
Arel.grouping v.map{|e| tmp.convert_to_node(e)}
end
|
.when(condition) ⇒ Object