aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/arel/nodes/casted.rb
diff options
context:
space:
mode:
authorMatthew Draper <matthew@trebex.net>2018-02-24 17:15:50 +1030
committerMatthew Draper <matthew@trebex.net>2018-02-24 17:16:13 +1030
commit4c0a3d48804a363c7e9272519665a21f601b5248 (patch)
tree6b1f6e28f85cfd69a0ce534856ef939c7079d5cf /activerecord/lib/arel/nodes/casted.rb
parent17ca17072dcdff11b3702a6b45f2fb0c8f8fe9a4 (diff)
downloadrails-4c0a3d48804a363c7e9272519665a21f601b5248.tar.gz
rails-4c0a3d48804a363c7e9272519665a21f601b5248.tar.bz2
rails-4c0a3d48804a363c7e9272519665a21f601b5248.zip
Arel: rubocop -a
Diffstat (limited to 'activerecord/lib/arel/nodes/casted.rb')
-rw-r--r--activerecord/lib/arel/nodes/casted.rb23
1 files changed, 12 insertions, 11 deletions
diff --git a/activerecord/lib/arel/nodes/casted.rb b/activerecord/lib/arel/nodes/casted.rb
index f945063dd2..c701e7ff41 100644
--- a/activerecord/lib/arel/nodes/casted.rb
+++ b/activerecord/lib/arel/nodes/casted.rb
@@ -1,9 +1,10 @@
# frozen_string_literal: true
+
module Arel
module Nodes
class Casted < Arel::Nodes::NodeExpression # :nodoc:
attr_reader :val, :attribute
- def initialize val, attribute
+ def initialize(val, attribute)
@val = val
@attribute = attribute
super()
@@ -15,7 +16,7 @@ module Arel
[self.class, val, attribute].hash
end
- def eql? other
+ def eql?(other)
self.class == other.class &&
self.val == other.val &&
self.attribute == other.attribute
@@ -28,17 +29,17 @@ module Arel
def nil?; val.nil?; end
end
- def self.build_quoted other, attribute = nil
+ def self.build_quoted(other, attribute = nil)
case other
- when Arel::Nodes::Node, Arel::Attributes::Attribute, Arel::Table, Arel::Nodes::BindParam, Arel::SelectManager, Arel::Nodes::Quoted, Arel::Nodes::SqlLiteral
- other
+ when Arel::Nodes::Node, Arel::Attributes::Attribute, Arel::Table, Arel::Nodes::BindParam, Arel::SelectManager, Arel::Nodes::Quoted, Arel::Nodes::SqlLiteral
+ other
+ else
+ case attribute
+ when Arel::Attributes::Attribute
+ Casted.new other, attribute
else
- case attribute
- when Arel::Attributes::Attribute
- Casted.new other, attribute
- else
- Quoted.new other
- end
+ Quoted.new other
+ end
end
end
end