1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Remove unused Arel::Attributes classes

I missed it in #36493, those classes should also no longer be used since
https://github.com/rails/arel/pull/196.
This commit is contained in:
Ryuta Kamizono 2021-03-11 11:33:39 +09:00
parent 8323fb5251
commit 168ddaa08a
3 changed files with 14 additions and 33 deletions

View file

@ -27,14 +27,6 @@ module Arel # :nodoc: all
relation.able_to_type_cast?
end
end
class String < Attribute; end
class Time < Attribute; end
class Boolean < Attribute; end
class Decimal < Attribute; end
class Float < Attribute; end
class Integer < Attribute; end
class Undefined < Attribute; end
end
Attribute = Attributes::Attribute

View file

@ -167,16 +167,10 @@ module Arel # :nodoc: all
visit_edge o, "attribute"
end
def visit_Arel_Attribute(o)
def visit_Arel_Attributes_Attribute(o)
visit_edge o, "relation"
visit_edge o, "name"
end
alias :visit_Arel_Attributes_Integer :visit_Arel_Attribute
alias :visit_Arel_Attributes_Float :visit_Arel_Attribute
alias :visit_Arel_Attributes_String :visit_Arel_Attribute
alias :visit_Arel_Attributes_Time :visit_Arel_Attribute
alias :visit_Arel_Attributes_Boolean :visit_Arel_Attribute
alias :visit_Arel_Attributes_Attribute :visit_Arel_Attribute
def nary(o)
o.children.each_with_index do |x, i|

View file

@ -322,11 +322,6 @@ module Arel
}
end
it "should visit visit_Arel_Attributes_Time" do
attr = Attributes::Time.new(@attr.relation, @attr.name)
compile attr
end
it "should visit_TrueClass" do
test = Table.new(:users)[:bool].eq(true)
_(compile(test)).must_be_like %{ "users"."bool" = 't' }
@ -445,22 +440,22 @@ module Arel
describe "Nodes::InfixOperation" do
it "should handle Multiplication" do
node = Arel::Attributes::Decimal.new(Table.new(:products), :price) * Arel::Attributes::Decimal.new(Table.new(:currency_rates), :rate)
node = Arel::Attribute.new(Table.new(:products), :price) * Arel::Attribute.new(Table.new(:currency_rates), :rate)
_(compile(node)).must_equal %("products"."price" * "currency_rates"."rate")
end
it "should handle Division" do
node = Arel::Attributes::Decimal.new(Table.new(:products), :price) / 5
node = Arel::Attribute.new(Table.new(:products), :price) / 5
_(compile(node)).must_equal %("products"."price" / 5)
end
it "should handle Addition" do
node = Arel::Attributes::Decimal.new(Table.new(:products), :price) + 6
node = Arel::Attribute.new(Table.new(:products), :price) + 6
_(compile(node)).must_equal %(("products"."price" + 6))
end
it "should handle Subtraction" do
node = Arel::Attributes::Decimal.new(Table.new(:products), :price) - 7
node = Arel::Attribute.new(Table.new(:products), :price) - 7
_(compile(node)).must_equal %(("products"."price" - 7))
end
@ -483,35 +478,35 @@ module Arel
end
it "should handle BitwiseAnd" do
node = Arel::Attributes::Integer.new(Table.new(:products), :bitmap) & 16
node = Arel::Attribute.new(Table.new(:products), :bitmap) & 16
_(compile(node)).must_equal %(("products"."bitmap" & 16))
end
it "should handle BitwiseOr" do
node = Arel::Attributes::Integer.new(Table.new(:products), :bitmap) | 16
node = Arel::Attribute.new(Table.new(:products), :bitmap) | 16
_(compile(node)).must_equal %(("products"."bitmap" | 16))
end
it "should handle BitwiseXor" do
node = Arel::Attributes::Integer.new(Table.new(:products), :bitmap) ^ 16
node = Arel::Attribute.new(Table.new(:products), :bitmap) ^ 16
_(compile(node)).must_equal %(("products"."bitmap" ^ 16))
end
it "should handle BitwiseShiftLeft" do
node = Arel::Attributes::Integer.new(Table.new(:products), :bitmap) << 4
node = Arel::Attribute.new(Table.new(:products), :bitmap) << 4
_(compile(node)).must_equal %(("products"."bitmap" << 4))
end
it "should handle BitwiseShiftRight" do
node = Arel::Attributes::Integer.new(Table.new(:products), :bitmap) >> 4
node = Arel::Attribute.new(Table.new(:products), :bitmap) >> 4
_(compile(node)).must_equal %(("products"."bitmap" >> 4))
end
it "should handle arbitrary operators" do
node = Arel::Nodes::InfixOperation.new(
"&&",
Arel::Attributes::String.new(Table.new(:products), :name),
Arel::Attributes::String.new(Table.new(:products), :name)
Arel::Attribute.new(Table.new(:products), :name),
Arel::Attribute.new(Table.new(:products), :name)
)
_(compile(node)).must_equal %("products"."name" && "products"."name")
end
@ -519,12 +514,12 @@ module Arel
describe "Nodes::UnaryOperation" do
it "should handle BitwiseNot" do
node = ~ Arel::Attributes::Integer.new(Table.new(:products), :bitmap)
node = ~ Arel::Attribute.new(Table.new(:products), :bitmap)
_(compile(node)).must_equal %( ~ "products"."bitmap")
end
it "should handle arbitrary operators" do
node = Arel::Nodes::UnaryOperation.new("!", Arel::Attributes::String.new(Table.new(:products), :active))
node = Arel::Nodes::UnaryOperation.new("!", Arel::Attribute.new(Table.new(:products), :active))
_(compile(node)).must_equal %( ! "products"."active")
end
end