Browse files

Replaced === checks with is_a? checks #502, #82 [Marcel Molina]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@466 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent db66885 commit b40d3c9e62325512e167b6fccc7d9d1a60948faa @dhh dhh committed Jan 20, 2005
View
2 activerecord/lib/active_record/base.rb
@@ -1203,7 +1203,7 @@ def quoted_comma_pair_list(column_quoter, hash)
end
def object_from_yaml(string)
- return string unless String === string
+ return string unless string.is_a?(String)
if has_yaml_encoding_header?(string)
begin
YAML::load(string)
View
6 activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
@@ -217,21 +217,21 @@ def binary_to_string(value)
private
def string_to_date(string)
- return string if Date === string
+ return string if string.is_a?(Date)
date_array = ParseDate.parsedate(string)
# treat 0000-00-00 as nil
Date.new(date_array[0], date_array[1], date_array[2]) rescue nil
end
def string_to_time(string)
- return string if Time === string
+ return string if string.is_a?(Time)
time_array = ParseDate.parsedate(string).compact
# treat 0000-00-00 00:00:00 as nil
Time.send(Base.default_timezone, *time_array) rescue nil
end
def string_to_dummy_time(string)
- return string if Time === string
+ return string if string.is_a?(Time)
time_array = ParseDate.parsedate(string)
# pad the resulting array with dummy date information
time_array[0] = 2000; time_array[1] = 1; time_array[2] = 1;
View
2 activerecord/lib/active_record/fixtures.rb
@@ -166,7 +166,7 @@ def self.create_fixtures(fixtures_directory, *table_names)
fixtures.each { |fixture| fixture.insert_fixtures }
end
- reset_sequences(connection, table_names) if ActiveRecord::ConnectionAdapters::PostgreSQLAdapter === connection
+ reset_sequences(connection, table_names) if connection.is_a?(ActiveRecord::ConnectionAdapters::PostgreSQLAdapter)
return fixtures.size > 1 ? fixtures : fixtures.first
ensure
View
4 activerecord/lib/active_record/validations.rb
@@ -372,9 +372,9 @@ def run_validations(validation_method)
validations = self.class.read_inheritable_attribute(validation_method.to_s)
if validations.nil? then return end
validations.each do |validation|
- if Symbol === validation
+ if validation.is_a?(Symbol)
self.send(validation)
- elsif String === validation
+ elsif validation.is_a?(String)
eval(validation, binding)
elsif validation_block?(validation)
validation.call(self)

0 comments on commit b40d3c9

Please sign in to comment.