From 52e8aff146c162986566d3e03852395729d7c24d Mon Sep 17 00:00:00 2001 From: Bryan Helmkamp Date: Wed, 30 Sep 2009 23:23:46 -0400 Subject: Move extensions directories to core_extensions --- lib/arel/engines/sql/core_extensions.rb | 4 ++++ lib/arel/engines/sql/core_extensions/array.rb | 16 ++++++++++++++++ lib/arel/engines/sql/core_extensions/nil_class.rb | 11 +++++++++++ lib/arel/engines/sql/core_extensions/object.rb | 15 +++++++++++++++ lib/arel/engines/sql/core_extensions/range.rb | 15 +++++++++++++++ lib/arel/engines/sql/extensions.rb | 4 ---- lib/arel/engines/sql/extensions/array.rb | 16 ---------------- lib/arel/engines/sql/extensions/nil_class.rb | 11 ----------- lib/arel/engines/sql/extensions/object.rb | 15 --------------- lib/arel/engines/sql/extensions/range.rb | 15 --------------- 10 files changed, 61 insertions(+), 61 deletions(-) create mode 100644 lib/arel/engines/sql/core_extensions.rb create mode 100644 lib/arel/engines/sql/core_extensions/array.rb create mode 100644 lib/arel/engines/sql/core_extensions/nil_class.rb create mode 100644 lib/arel/engines/sql/core_extensions/object.rb create mode 100644 lib/arel/engines/sql/core_extensions/range.rb delete mode 100644 lib/arel/engines/sql/extensions.rb delete mode 100644 lib/arel/engines/sql/extensions/array.rb delete mode 100644 lib/arel/engines/sql/extensions/nil_class.rb delete mode 100644 lib/arel/engines/sql/extensions/object.rb delete mode 100644 lib/arel/engines/sql/extensions/range.rb (limited to 'lib/arel/engines/sql') diff --git a/lib/arel/engines/sql/core_extensions.rb b/lib/arel/engines/sql/core_extensions.rb new file mode 100644 index 0000000000..c8d9ec239e --- /dev/null +++ b/lib/arel/engines/sql/core_extensions.rb @@ -0,0 +1,4 @@ +require 'arel/engines/sql/core_extensions/object' +require 'arel/engines/sql/core_extensions/array' +require 'arel/engines/sql/core_extensions/range' +require 'arel/engines/sql/core_extensions/nil_class' diff --git a/lib/arel/engines/sql/core_extensions/array.rb b/lib/arel/engines/sql/core_extensions/array.rb new file mode 100644 index 0000000000..80041cb5f3 --- /dev/null +++ b/lib/arel/engines/sql/core_extensions/array.rb @@ -0,0 +1,16 @@ +module Arel + module Sql + module ArrayExtensions + def to_sql(formatter = nil) + "(" + collect { |e| e.to_sql(formatter) }.join(', ') + ")" + end + + def inclusion_predicate_sql + "IN" + end + + Array.send(:include, self) + end + end +end + diff --git a/lib/arel/engines/sql/core_extensions/nil_class.rb b/lib/arel/engines/sql/core_extensions/nil_class.rb new file mode 100644 index 0000000000..c3dbc8cd76 --- /dev/null +++ b/lib/arel/engines/sql/core_extensions/nil_class.rb @@ -0,0 +1,11 @@ +module Arel + module Sql + module NilClassExtensions + def equality_predicate_sql + 'IS' + end + + NilClass.send(:include, self) + end + end +end diff --git a/lib/arel/engines/sql/core_extensions/object.rb b/lib/arel/engines/sql/core_extensions/object.rb new file mode 100644 index 0000000000..9f15dff771 --- /dev/null +++ b/lib/arel/engines/sql/core_extensions/object.rb @@ -0,0 +1,15 @@ +module Arel + module Sql + module ObjectExtensions + def to_sql(formatter) + formatter.scalar self + end + + def equality_predicate_sql + '=' + end + + Object.send(:include, self) + end + end +end diff --git a/lib/arel/engines/sql/core_extensions/range.rb b/lib/arel/engines/sql/core_extensions/range.rb new file mode 100644 index 0000000000..46124f8865 --- /dev/null +++ b/lib/arel/engines/sql/core_extensions/range.rb @@ -0,0 +1,15 @@ +module Arel + module Sql + module RangeExtensions + def to_sql(formatter = nil) + formatter.range self.begin, self.end + end + + def inclusion_predicate_sql + "BETWEEN" + end + + Range.send(:include, self) + end + end +end diff --git a/lib/arel/engines/sql/extensions.rb b/lib/arel/engines/sql/extensions.rb deleted file mode 100644 index 1ea31bc140..0000000000 --- a/lib/arel/engines/sql/extensions.rb +++ /dev/null @@ -1,4 +0,0 @@ -require 'arel/engines/sql/extensions/object' -require 'arel/engines/sql/extensions/array' -require 'arel/engines/sql/extensions/range' -require 'arel/engines/sql/extensions/nil_class' diff --git a/lib/arel/engines/sql/extensions/array.rb b/lib/arel/engines/sql/extensions/array.rb deleted file mode 100644 index 80041cb5f3..0000000000 --- a/lib/arel/engines/sql/extensions/array.rb +++ /dev/null @@ -1,16 +0,0 @@ -module Arel - module Sql - module ArrayExtensions - def to_sql(formatter = nil) - "(" + collect { |e| e.to_sql(formatter) }.join(', ') + ")" - end - - def inclusion_predicate_sql - "IN" - end - - Array.send(:include, self) - end - end -end - diff --git a/lib/arel/engines/sql/extensions/nil_class.rb b/lib/arel/engines/sql/extensions/nil_class.rb deleted file mode 100644 index c3dbc8cd76..0000000000 --- a/lib/arel/engines/sql/extensions/nil_class.rb +++ /dev/null @@ -1,11 +0,0 @@ -module Arel - module Sql - module NilClassExtensions - def equality_predicate_sql - 'IS' - end - - NilClass.send(:include, self) - end - end -end diff --git a/lib/arel/engines/sql/extensions/object.rb b/lib/arel/engines/sql/extensions/object.rb deleted file mode 100644 index 9f15dff771..0000000000 --- a/lib/arel/engines/sql/extensions/object.rb +++ /dev/null @@ -1,15 +0,0 @@ -module Arel - module Sql - module ObjectExtensions - def to_sql(formatter) - formatter.scalar self - end - - def equality_predicate_sql - '=' - end - - Object.send(:include, self) - end - end -end diff --git a/lib/arel/engines/sql/extensions/range.rb b/lib/arel/engines/sql/extensions/range.rb deleted file mode 100644 index 46124f8865..0000000000 --- a/lib/arel/engines/sql/extensions/range.rb +++ /dev/null @@ -1,15 +0,0 @@ -module Arel - module Sql - module RangeExtensions - def to_sql(formatter = nil) - formatter.range self.begin, self.end - end - - def inclusion_predicate_sql - "BETWEEN" - end - - Range.send(:include, self) - end - end -end -- cgit v1.2.3