aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/arel/algebra.rb2
-rw-r--r--lib/arel/algebra/extensions/array.rb4
-rw-r--r--lib/arel/algebra/extensions/class.rb10
-rw-r--r--lib/arel/algebra/extensions/hash.rb2
-rw-r--r--lib/arel/algebra/extensions/pathname.rb2
-rw-r--r--lib/arel/algebra/extensions/symbol.rb2
-rw-r--r--lib/arel/algebra/predicates.rb2
-rw-r--r--lib/arel/algebra/primitives/attribute.rb8
-rw-r--r--lib/arel/algebra/primitives/ordering.rb8
-rw-r--r--lib/arel/algebra/relations.rb2
-rw-r--r--lib/arel/algebra/relations/operations/alias.rb2
-rw-r--r--lib/arel/algebra/relations/operations/group.rb2
-rw-r--r--lib/arel/algebra/relations/operations/join.rb4
-rw-r--r--lib/arel/algebra/relations/operations/order.rb4
-rw-r--r--lib/arel/algebra/relations/operations/skip.rb4
-rw-r--r--lib/arel/algebra/relations/operations/take.rb4
-rw-r--r--lib/arel/algebra/relations/row.rb10
-rw-r--r--lib/arel/algebra/relations/utilities/compound.rb2
-rw-r--r--lib/arel/algebra/relations/writes.rb10
-rw-r--r--lib/arel/engines.rb2
-rw-r--r--lib/arel/engines/memory.rb2
-rw-r--r--lib/arel/engines/memory/engine.rb4
-rw-r--r--lib/arel/engines/memory/primitives.rb10
-rw-r--r--lib/arel/engines/memory/relations/array.rb6
-rw-r--r--lib/arel/engines/memory/relations/compound.rb2
-rw-r--r--lib/arel/engines/memory/relations/operations.rb16
-rw-r--r--lib/arel/engines/memory/relations/writes.rb4
-rw-r--r--lib/arel/engines/sql.rb2
-rw-r--r--lib/arel/engines/sql/christener.rb2
-rw-r--r--lib/arel/engines/sql/engine.rb6
-rw-r--r--lib/arel/engines/sql/extensions.rb2
-rw-r--r--lib/arel/engines/sql/extensions/array.rb2
-rw-r--r--lib/arel/engines/sql/extensions/nil_class.rb2
-rw-r--r--lib/arel/engines/sql/extensions/object.rb2
-rw-r--r--lib/arel/engines/sql/extensions/range.rb4
-rw-r--r--lib/arel/engines/sql/formatters.rb2
-rw-r--r--lib/arel/engines/sql/predicates.rb2
-rw-r--r--lib/arel/engines/sql/primitives.rb10
-rw-r--r--lib/arel/engines/sql/relations.rb2
-rw-r--r--lib/arel/engines/sql/relations/operations/alias.rb2
-rw-r--r--lib/arel/engines/sql/relations/operations/join.rb2
-rw-r--r--lib/arel/engines/sql/relations/relation.rb2
-rw-r--r--lib/arel/engines/sql/relations/table.rb2
-rw-r--r--lib/arel/engines/sql/relations/utilities/compound.rb2
-rw-r--r--lib/arel/engines/sql/relations/utilities/externalization.rb2
-rw-r--r--lib/arel/engines/sql/relations/utilities/nil.rb2
-rw-r--r--lib/arel/engines/sql/relations/utilities/recursion.rb2
-rw-r--r--lib/arel/engines/sql/relations/writes.rb2
-rw-r--r--spec/arel/algebra/unit/predicates/binary_spec.rb8
-rw-r--r--spec/arel/algebra/unit/predicates/equality_spec.rb10
-rw-r--r--spec/arel/algebra/unit/predicates/in_spec.rb2
-rw-r--r--spec/arel/algebra/unit/primitives/attribute_spec.rb58
-rw-r--r--spec/arel/algebra/unit/primitives/expression_spec.rb12
-rw-r--r--spec/arel/algebra/unit/primitives/value_spec.rb2
-rw-r--r--spec/arel/algebra/unit/relations/alias_spec.rb4
-rw-r--r--spec/arel/algebra/unit/relations/delete_spec.rb2
-rw-r--r--spec/arel/algebra/unit/relations/group_spec.rb2
-rw-r--r--spec/arel/algebra/unit/relations/insert_spec.rb2
-rw-r--r--spec/arel/algebra/unit/relations/join_spec.rb6
-rw-r--r--spec/arel/algebra/unit/relations/order_spec.rb2
-rw-r--r--spec/arel/algebra/unit/relations/project_spec.rb10
-rw-r--r--spec/arel/algebra/unit/relations/relation_spec.rb36
-rw-r--r--spec/arel/algebra/unit/relations/skip_spec.rb2
-rw-r--r--spec/arel/algebra/unit/relations/table_spec.rb10
-rw-r--r--spec/arel/algebra/unit/relations/take_spec.rb2
-rw-r--r--spec/arel/algebra/unit/relations/update_spec.rb2
-rw-r--r--spec/arel/algebra/unit/relations/where_spec.rb6
-rw-r--r--spec/arel/algebra/unit/session/session_spec.rb22
-rw-r--r--spec/arel/engines/memory/integration/joins/cross_engine_spec.rb2
-rw-r--r--spec/arel/engines/memory/unit/relations/array_spec.rb2
-rw-r--r--spec/arel/engines/memory/unit/relations/insert_spec.rb4
-rw-r--r--spec/arel/engines/memory/unit/relations/join_spec.rb4
-rw-r--r--spec/arel/engines/memory/unit/relations/order_spec.rb4
-rw-r--r--spec/arel/engines/memory/unit/relations/project_spec.rb4
-rw-r--r--spec/arel/engines/memory/unit/relations/skip_spec.rb4
-rw-r--r--spec/arel/engines/memory/unit/relations/take_spec.rb4
-rw-r--r--spec/arel/engines/memory/unit/relations/where_spec.rb6
-rw-r--r--spec/arel/engines/sql/unit/predicates/binary_spec.rb2
-rw-r--r--spec/arel/engines/sql/unit/predicates/equality_spec.rb2
-rw-r--r--spec/arel/engines/sql/unit/predicates/in_spec.rb2
-rw-r--r--spec/arel/engines/sql/unit/primitives/attribute_spec.rb4
-rw-r--r--spec/arel/engines/sql/unit/relations/group_spec.rb2
-rw-r--r--spec/arel/engines/sql/unit/relations/join_spec.rb2
-rw-r--r--spec/arel/engines/sql/unit/relations/skip_spec.rb2
-rw-r--r--spec/arel/engines/sql/unit/relations/table_spec.rb2
-rw-r--r--spec/arel/engines/sql/unit/relations/take_spec.rb2
-rw-r--r--spec/arel/unit/predicates/predicates_spec.rb2
-rw-r--r--spec/connections/mysql_connection.rb2
-rw-r--r--spec/doubles/hash.rb8
-rw-r--r--spec/matchers/be_like.rb10
-rw-r--r--spec/matchers/disambiguate_attributes.rb10
-rw-r--r--spec/matchers/hash_the_same_as.rb10
-rw-r--r--spec/schemas/mysql_schema.rb2
-rw-r--r--spec/schemas/sqlite3_schema.rb2
94 files changed, 243 insertions, 243 deletions
diff --git a/lib/arel/algebra.rb b/lib/arel/algebra.rb
index f27882a343..c206fea0b0 100644
--- a/lib/arel/algebra.rb
+++ b/lib/arel/algebra.rb
@@ -1,4 +1,4 @@
require 'arel/algebra/extensions'
require 'arel/algebra/predicates'
require 'arel/algebra/relations'
-require 'arel/algebra/primitives' \ No newline at end of file
+require 'arel/algebra/primitives'
diff --git a/lib/arel/algebra/extensions/array.rb b/lib/arel/algebra/extensions/array.rb
index 935569a07b..48541a395e 100644
--- a/lib/arel/algebra/extensions/array.rb
+++ b/lib/arel/algebra/extensions/array.rb
@@ -2,11 +2,11 @@ class Array
def to_hash
Hash[*flatten]
end
-
+
def group_by
inject({}) do |groups, element|
(groups[yield(element)] ||= []) << element
groups
end
end
-end \ No newline at end of file
+end
diff --git a/lib/arel/algebra/extensions/class.rb b/lib/arel/algebra/extensions/class.rb
index f37898e7d7..0a729d8255 100644
--- a/lib/arel/algebra/extensions/class.rb
+++ b/lib/arel/algebra/extensions/class.rb
@@ -3,11 +3,11 @@ class Class
@attributes = attrs
attr_reader *attrs
end
-
+
def deriving(*methods)
methods.each { |m| derive m }
end
-
+
def derive(method_name)
methods = {
:initialize => "
@@ -24,14 +24,14 @@ class Class
}
class_eval methods[method_name], __FILE__, __LINE__
end
-
+
def hash_on(delegatee)
define_method :eql? do |other|
self == other
end
-
+
define_method :hash do
@hash ||= delegatee.hash
end
end
-end \ No newline at end of file
+end
diff --git a/lib/arel/algebra/extensions/hash.rb b/lib/arel/algebra/extensions/hash.rb
index 7472b5aa73..82cd5e11d3 100644
--- a/lib/arel/algebra/extensions/hash.rb
+++ b/lib/arel/algebra/extensions/hash.rb
@@ -4,4 +4,4 @@ class Hash
bound.merge(key.bind(relation) => value.bind(relation))
end
end
-end \ No newline at end of file
+end
diff --git a/lib/arel/algebra/extensions/pathname.rb b/lib/arel/algebra/extensions/pathname.rb
index 2f7e2733e7..45f1a5f6b3 100644
--- a/lib/arel/algebra/extensions/pathname.rb
+++ b/lib/arel/algebra/extensions/pathname.rb
@@ -2,4 +2,4 @@ class Pathname
def /(path)
(self + path).expand_path
end
-end \ No newline at end of file
+end
diff --git a/lib/arel/algebra/extensions/symbol.rb b/lib/arel/algebra/extensions/symbol.rb
index 787867bdc3..8d324a801c 100644
--- a/lib/arel/algebra/extensions/symbol.rb
+++ b/lib/arel/algebra/extensions/symbol.rb
@@ -2,4 +2,4 @@ class Symbol
def to_attribute(relation)
Arel::Attribute.new(relation, self)
end
-end \ No newline at end of file
+end
diff --git a/lib/arel/algebra/predicates.rb b/lib/arel/algebra/predicates.rb
index 7f093ded6d..72167c2b27 100644
--- a/lib/arel/algebra/predicates.rb
+++ b/lib/arel/algebra/predicates.rb
@@ -38,4 +38,4 @@ module Arel
class LessThan < Binary; end
class Match < Binary; end
class In < Binary; end
-end \ No newline at end of file
+end
diff --git a/lib/arel/algebra/primitives/attribute.rb b/lib/arel/algebra/primitives/attribute.rb
index aa1f2ae00c..44a2f41733 100644
--- a/lib/arel/algebra/primitives/attribute.rb
+++ b/lib/arel/algebra/primitives/attribute.rb
@@ -17,7 +17,7 @@ module Arel
def aggregation?
false
end
-
+
def inspect
"<Attribute #{name}>"
end
@@ -133,16 +133,16 @@ module Arel
end
end
include Expressions
-
+
module Orderings
def asc
Ascending.new(self)
end
-
+
def desc
Descending.new(self)
end
-
+
alias_method :to_ordering, :asc
end
include Orderings
diff --git a/lib/arel/algebra/primitives/ordering.rb b/lib/arel/algebra/primitives/ordering.rb
index e8d8f97188..a60d794f27 100644
--- a/lib/arel/algebra/primitives/ordering.rb
+++ b/lib/arel/algebra/primitives/ordering.rb
@@ -3,16 +3,16 @@ module Arel
attributes :attribute
deriving :initialize, :==
delegate :relation, :to => :attribute
-
+
def bind(relation)
self.class.new(attribute.bind(relation))
end
-
+
def to_ordering
self
end
end
-
+
class Ascending < Ordering; end
class Descending < Ordering; end
-end \ No newline at end of file
+end
diff --git a/lib/arel/algebra/relations.rb b/lib/arel/algebra/relations.rb
index 94df5938fe..f9fa24ba25 100644
--- a/lib/arel/algebra/relations.rb
+++ b/lib/arel/algebra/relations.rb
@@ -11,4 +11,4 @@ require 'arel/algebra/relations/operations/order'
require 'arel/algebra/relations/operations/project'
require 'arel/algebra/relations/operations/where'
require 'arel/algebra/relations/operations/skip'
-require 'arel/algebra/relations/operations/take' \ No newline at end of file
+require 'arel/algebra/relations/operations/take'
diff --git a/lib/arel/algebra/relations/operations/alias.rb b/lib/arel/algebra/relations/operations/alias.rb
index 67837f6a75..0331d98b85 100644
--- a/lib/arel/algebra/relations/operations/alias.rb
+++ b/lib/arel/algebra/relations/operations/alias.rb
@@ -4,4 +4,4 @@ module Arel
deriving :initialize
alias_method :==, :equal?
end
-end \ No newline at end of file
+end
diff --git a/lib/arel/algebra/relations/operations/group.rb b/lib/arel/algebra/relations/operations/group.rb
index 879f2352c5..b8975ed3d6 100644
--- a/lib/arel/algebra/relations/operations/group.rb
+++ b/lib/arel/algebra/relations/operations/group.rb
@@ -13,4 +13,4 @@ module Arel
true
end
end
-end \ No newline at end of file
+end
diff --git a/lib/arel/algebra/relations/operations/join.rb b/lib/arel/algebra/relations/operations/join.rb
index 02a8fa629d..e47d9fa9e0 100644
--- a/lib/arel/algebra/relations/operations/join.rb
+++ b/lib/arel/algebra/relations/operations/join.rb
@@ -31,7 +31,7 @@ module Arel
def join?
true
end
-
+
def engine
relation1.engine != relation2.engine ? Memory::Engine.new : relation1.engine
end
@@ -43,7 +43,7 @@ module Arel
def attributes
relation1.externalize.attributes
end
-
+
def engine
relation1.engine
end
diff --git a/lib/arel/algebra/relations/operations/order.rb b/lib/arel/algebra/relations/operations/order.rb
index 4e7133f5a8..a589b56997 100644
--- a/lib/arel/algebra/relations/operations/order.rb
+++ b/lib/arel/algebra/relations/operations/order.rb
@@ -2,7 +2,7 @@ module Arel
class Order < Compound
attributes :relation, :orderings
deriving :==
-
+
def initialize(relation, *orderings, &block)
@relation = relation
@orderings = (orderings + arguments_from_block(relation, &block)) \
@@ -15,4 +15,4 @@ module Arel
(orderings + relation.orders).collect { |o| o.bind(self) }.collect { |o| o.to_ordering }
end
end
-end \ No newline at end of file
+end
diff --git a/lib/arel/algebra/relations/operations/skip.rb b/lib/arel/algebra/relations/operations/skip.rb
index 930e4c94ea..2dda191c35 100644
--- a/lib/arel/algebra/relations/operations/skip.rb
+++ b/lib/arel/algebra/relations/operations/skip.rb
@@ -2,9 +2,9 @@ module Arel
class Skip < Compound
attributes :relation, :skipped
deriving :initialize, :==
-
+
def externalizable?
true
end
end
-end \ No newline at end of file
+end
diff --git a/lib/arel/algebra/relations/operations/take.rb b/lib/arel/algebra/relations/operations/take.rb
index 2fd3fdf635..eb32ec492e 100644
--- a/lib/arel/algebra/relations/operations/take.rb
+++ b/lib/arel/algebra/relations/operations/take.rb
@@ -2,9 +2,9 @@ module Arel
class Take < Compound
attributes :relation, :taken
deriving :initialize, :==
-
+
def externalizable?
true
end
end
-end \ No newline at end of file
+end
diff --git a/lib/arel/algebra/relations/row.rb b/lib/arel/algebra/relations/row.rb
index e8484944bd..3158557448 100644
--- a/lib/arel/algebra/relations/row.rb
+++ b/lib/arel/algebra/relations/row.rb
@@ -2,11 +2,11 @@ module Arel
class Row
attributes :relation, :tuple
deriving :==, :initialize
-
+
def [](attribute)
attribute.type_cast(tuple[relation.position_of(attribute)])
end
-
+
def slice(*attributes)
Row.new(relation, attributes.inject([]) do |cheese, attribute|
# FIXME TESTME method chaining
@@ -14,13 +14,13 @@ module Arel
cheese
end)
end
-
+
def bind(relation)
Row.new(relation, tuple)
end
-
+
def combine(other, relation)
Row.new(relation, tuple + other.tuple)
end
end
-end \ No newline at end of file
+end
diff --git a/lib/arel/algebra/relations/utilities/compound.rb b/lib/arel/algebra/relations/utilities/compound.rb
index 99c3d02748..676d80a737 100644
--- a/lib/arel/algebra/relations/utilities/compound.rb
+++ b/lib/arel/algebra/relations/utilities/compound.rb
@@ -13,7 +13,7 @@ module Arel
end
OPERATION
end
-
+
private
def arguments_from_block(relation, &block)
block_given?? [yield(relation)] : []
diff --git a/lib/arel/algebra/relations/writes.rb b/lib/arel/algebra/relations/writes.rb
index 352f7bc7e5..d344987915 100644
--- a/lib/arel/algebra/relations/writes.rb
+++ b/lib/arel/algebra/relations/writes.rb
@@ -2,7 +2,7 @@ module Arel
class Deletion < Compound
attributes :relation
deriving :initialize, :==
-
+
def call
engine.delete(self)
end
@@ -15,7 +15,7 @@ module Arel
def initialize(relation, record)
@relation, @record = relation, record.bind(relation)
end
-
+
def call
engine.create(self)
end
@@ -24,13 +24,13 @@ module Arel
class Update < Compound
attributes :relation, :assignments
deriving :==
-
+
def initialize(relation, assignments)
@relation, @assignments = relation, assignments.bind(relation)
end
-
+
def call
engine.update(self)
end
end
-end \ No newline at end of file
+end
diff --git a/lib/arel/engines.rb b/lib/arel/engines.rb
index 3f854edf90..cd848d83e2 100644
--- a/lib/arel/engines.rb
+++ b/lib/arel/engines.rb
@@ -1,2 +1,2 @@
require 'arel/engines/sql'
-require 'arel/engines/memory' \ No newline at end of file
+require 'arel/engines/memory'
diff --git a/lib/arel/engines/memory.rb b/lib/arel/engines/memory.rb
index df6f6f3d48..9e7193ef13 100644
--- a/lib/arel/engines/memory.rb
+++ b/lib/arel/engines/memory.rb
@@ -1,4 +1,4 @@
require 'arel/engines/memory/relations'
require 'arel/engines/memory/primitives'
require 'arel/engines/memory/engine'
-require 'arel/engines/memory/predicates' \ No newline at end of file
+require 'arel/engines/memory/predicates'
diff --git a/lib/arel/engines/memory/engine.rb b/lib/arel/engines/memory/engine.rb
index c8f79c9d57..c7ac9422d4 100644
--- a/lib/arel/engines/memory/engine.rb
+++ b/lib/arel/engines/memory/engine.rb
@@ -5,7 +5,7 @@ module Arel
def read(relation)
relation.eval
end
-
+
def create(relation)
relation.eval
end
@@ -13,4 +13,4 @@ module Arel
include CRUD
end
end
-end \ No newline at end of file
+end
diff --git a/lib/arel/engines/memory/primitives.rb b/lib/arel/engines/memory/primitives.rb
index f8bbcedb55..935b34f5ee 100644
--- a/lib/arel/engines/memory/primitives.rb
+++ b/lib/arel/engines/memory/primitives.rb
@@ -4,24 +4,24 @@ module Arel
row[self]
end
end
-
+
class Value
def eval(row)
value
end
end
-
+
class Ordering
def eval(row1, row2)
(attribute.eval(row1) <=> attribute.eval(row2)) * direction
end
end
-
+
class Descending < Ordering
def direction; -1 end
end
-
+
class Ascending < Ordering
def direction; 1 end
end
-end \ No newline at end of file
+end
diff --git a/lib/arel/engines/memory/relations/array.rb b/lib/arel/engines/memory/relations/array.rb
index 6e2dc29252..5e7c0a4ab1 100644
--- a/lib/arel/engines/memory/relations/array.rb
+++ b/lib/arel/engines/memory/relations/array.rb
@@ -3,7 +3,7 @@ module Arel
attributes :array, :attribute_names
include Recursion::BaseCase
deriving :==, :initialize
-
+
def engine
@engine ||= Memory::Engine.new
end
@@ -17,9 +17,9 @@ module Arel
def format(attribute, value)
value
end
-
+
def eval
@array.collect { |r| Row.new(self, r) }
end
end
-end \ No newline at end of file
+end
diff --git a/lib/arel/engines/memory/relations/compound.rb b/lib/arel/engines/memory/relations/compound.rb
index 9e7827dfb3..6dda92a6a1 100644
--- a/lib/arel/engines/memory/relations/compound.rb
+++ b/lib/arel/engines/memory/relations/compound.rb
@@ -1,7 +1,7 @@
module Arel
class Compound < Relation
delegate :array, :to => :relation
-
+
def unoperated_rows
relation.call.collect { |row| row.bind(self) }
end
diff --git a/lib/arel/engines/memory/relations/operations.rb b/lib/arel/engines/memory/relations/operations.rb
index e0fd2824b3..8e01938360 100644
--- a/lib/arel/engines/memory/relations/operations.rb
+++ b/lib/arel/engines/memory/relations/operations.rb
@@ -4,7 +4,7 @@ module Arel
unoperated_rows.select { |row| predicate.eval(row) }
end
end
-
+
class Order < Compound
def eval
unoperated_rows.sort do |row1, row2|
@@ -13,37 +13,37 @@ module Arel
end
end
end
-
+
class Project < Compound
def eval
unoperated_rows.collect { |r| r.slice(*projections) }
end
end
-
+
class Take < Compound
def eval
unoperated_rows[0, taken]
end
end
-
+
class Skip < Compound
def eval
unoperated_rows[skipped..-1]
end
end
-
+
class Group < Compound
def eval
raise NotImplementedError
end
end
-
+
class Alias < Compound
def eval
unoperated_rows
end
end
-
+
class Join < Relation
def eval
result = []
@@ -58,4 +58,4 @@ module Arel
result
end
end
-end \ No newline at end of file
+end
diff --git a/lib/arel/engines/memory/relations/writes.rb b/lib/arel/engines/memory/relations/writes.rb
index fa8b84a32c..12c4f36c0d 100644
--- a/lib/arel/engines/memory/relations/writes.rb
+++ b/lib/arel/engines/memory/relations/writes.rb
@@ -1,7 +1,7 @@
module Arel
class Insert < Compound
def eval
- unoperated_rows + [Row.new(self, record.values.collect(&:value))]
+ unoperated_rows + [Row.new(self, record.values.collect(&:value))]
end
end
-end \ No newline at end of file
+end
diff --git a/lib/arel/engines/sql.rb b/lib/arel/engines/sql.rb
index aed1fd861e..f31cfc7dac 100644
--- a/lib/arel/engines/sql.rb
+++ b/lib/arel/engines/sql.rb
@@ -4,4 +4,4 @@ require 'arel/engines/sql/primitives'
require 'arel/engines/sql/predicates'
require 'arel/engines/sql/formatters'
require 'arel/engines/sql/extensions'
-require 'arel/engines/sql/christener' \ No newline at end of file
+require 'arel/engines/sql/christener'
diff --git a/lib/arel/engines/sql/christener.rb b/lib/arel/engines/sql/christener.rb
index 5883a75f41..c1c9325208 100644
--- a/lib/arel/engines/sql/christener.rb
+++ b/lib/arel/engines/sql/christener.rb
@@ -10,4 +10,4 @@ module Arel
end
end
end
-end \ No newline at end of file
+end
diff --git a/lib/arel/engines/sql/engine.rb b/lib/arel/engines/sql/engine.rb
index d27d93a5dc..5a8c9f16c5 100644
--- a/lib/arel/engines/sql/engine.rb
+++ b/lib/arel/engines/sql/engine.rb
@@ -21,11 +21,11 @@ module Arel
def read(relation)
# FIXME
rows = connection.select_rows(relation.to_sql)
-
+
class << rows
include Enumerable
end
-
+
Array.new(rows, relation.attributes)
end
@@ -40,4 +40,4 @@ module Arel
include CRUD
end
end
-end \ No newline at end of file
+end
diff --git a/lib/arel/engines/sql/extensions.rb b/lib/arel/engines/sql/extensions.rb
index 6f4ad32148..1ea31bc140 100644
--- a/lib/arel/engines/sql/extensions.rb
+++ b/lib/arel/engines/sql/extensions.rb
@@ -1,4 +1,4 @@
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' \ No newline at end of file
+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
index 1daa5abca7..d97dd1aa25 100644
--- a/lib/arel/engines/sql/extensions/array.rb
+++ b/lib/arel/engines/sql/extensions/array.rb
@@ -6,4 +6,4 @@ class Array
def inclusion_predicate_sql
"IN"
end
-end \ No newline at end of file
+end
diff --git a/lib/arel/engines/sql/extensions/nil_class.rb b/lib/arel/engines/sql/extensions/nil_class.rb
index 729c4cada7..6f38ecdf3a 100644
--- a/lib/arel/engines/sql/extensions/nil_class.rb
+++ b/lib/arel/engines/sql/extensions/nil_class.rb
@@ -2,4 +2,4 @@ class NilClass
def equality_predicate_sql
'IS'
end
-end \ No newline at end of file
+end
diff --git a/lib/arel/engines/sql/extensions/object.rb b/lib/arel/engines/sql/extensions/object.rb
index ef990eee2f..65270ee3de 100644
--- a/lib/arel/engines/sql/extensions/object.rb
+++ b/lib/arel/engines/sql/extensions/object.rb
@@ -6,4 +6,4 @@ class Object
def equality_predicate_sql
'='
end
-end \ No newline at end of file
+end
diff --git a/lib/arel/engines/sql/extensions/range.rb b/lib/arel/engines/sql/extensions/range.rb
index d7329efe34..946dbc2633 100644
--- a/lib/arel/engines/sql/extensions/range.rb
+++ b/lib/arel/engines/sql/extensions/range.rb
@@ -2,8 +2,8 @@ class Range
def to_sql(formatter = nil)
formatter.range self.begin, self.end
end
-
+
def inclusion_predicate_sql
"BETWEEN"
end
-end \ No newline at end of file
+end
diff --git a/lib/arel/engines/sql/formatters.rb b/lib/arel/engines/sql/formatters.rb
index bc5f0f7c64..08a32843c9 100644
--- a/lib/arel/engines/sql/formatters.rb
+++ b/lib/arel/engines/sql/formatters.rb
@@ -47,7 +47,7 @@ module Arel
class WhereClause < PassThrough
end
- class OrderClause < PassThrough
+ class OrderClause < PassThrough
def ordering(ordering)
"#{quote_table_name(name_for(ordering.attribute.original_relation))}.#{quote_column_name(ordering.attribute.name)} #{ordering.direction_sql}"
end
diff --git a/lib/arel/engines/sql/predicates.rb b/lib/arel/engines/sql/predicates.rb
index dfeddb2de1..7e195c2605 100644
--- a/lib/arel/engines/sql/predicates.rb
+++ b/lib/arel/engines/sql/predicates.rb
@@ -34,4 +34,4 @@ module Arel
class In < Binary
def predicate_sql; operand2.inclusion_predicate_sql end
end
-end \ No newline at end of file
+end
diff --git a/lib/arel/engines/sql/primitives.rb b/lib/arel/engines/sql/primitives.rb
index 22ee19dcf0..f2e8e8dabe 100644
--- a/lib/arel/engines/sql/primitives.rb
+++ b/lib/arel/engines/sql/primitives.rb
@@ -7,7 +7,7 @@ module Arel
def type_cast(value)
root.relation.format(self, value)
end
-
+
def format(object)
object.to_sql(Sql::Attribute.new(self))
end
@@ -28,17 +28,17 @@ module Arel
object.to_sql(Sql::Value.new(relation))
end
end
-
+
class Ordering
def to_sql(formatter = Sql::OrderClause.new(relation))
formatter.ordering self
end
end
-
+
class Ascending < Ordering
def direction_sql; 'ASC' end
end
-
+
class Descending < Ordering
def direction_sql; 'DESC' end
end
@@ -72,4 +72,4 @@ module Arel
class Average < Expression
def function_sql; 'AVG' end
end
-end \ No newline at end of file
+end
diff --git a/lib/arel/engines/sql/relations.rb b/lib/arel/engines/sql/relations.rb
index 0eb1303ec9..8360a1f806 100644
--- a/lib/arel/engines/sql/relations.rb
+++ b/lib/arel/engines/sql/relations.rb
@@ -6,4 +6,4 @@ require 'arel/engines/sql/relations/relation'
require 'arel/engines/sql/relations/table'
require 'arel/engines/sql/relations/operations/join'
require 'arel/engines/sql/relations/operations/alias'
-require 'arel/engines/sql/relations/writes' \ No newline at end of file
+require 'arel/engines/sql/relations/writes'
diff --git a/lib/arel/engines/sql/relations/operations/alias.rb b/lib/arel/engines/sql/relations/operations/alias.rb
index 32c9911a69..9b6a484463 100644
--- a/lib/arel/engines/sql/relations/operations/alias.rb
+++ b/lib/arel/engines/sql/relations/operations/alias.rb
@@ -2,4 +2,4 @@ module Arel
class Alias < Compound
include Recursion::BaseCase
end
-end \ No newline at end of file
+end
diff --git a/lib/arel/engines/sql/relations/operations/join.rb b/lib/arel/engines/sql/relations/operations/join.rb
index f848fd3268..7c5e13510a 100644
--- a/lib/arel/engines/sql/relations/operations/join.rb
+++ b/lib/arel/engines/sql/relations/operations/join.rb
@@ -30,4 +30,4 @@ module Arel
relation2
end
end
-end \ No newline at end of file
+end
diff --git a/lib/arel/engines/sql/relations/relation.rb b/lib/arel/engines/sql/relations/relation.rb
index 5fd4121176..93c146352c 100644
--- a/lib/arel/engines/sql/relations/relation.rb
+++ b/lib/arel/engines/sql/relations/relation.rb
@@ -25,4 +25,4 @@ module Arel
@christener ||= Sql::Christener.new
end
end
-end \ No newline at end of file
+end
diff --git a/lib/arel/engines/sql/relations/table.rb b/lib/arel/engines/sql/relations/table.rb
index e842f85ed1..0b6574eedc 100644
--- a/lib/arel/engines/sql/relations/table.rb
+++ b/lib/arel/engines/sql/relations/table.rb
@@ -19,7 +19,7 @@ module Arel
def format(attribute, value)
attribute.column.type_cast(value)
end
-
+
def column_for(attribute)
has_attribute?(attribute) and columns.detect { |c| c.name == attribute.name.to_s }
end
diff --git a/lib/arel/engines/sql/relations/utilities/compound.rb b/lib/arel/engines/sql/relations/utilities/compound.rb
index 61df196d6e..b63a829c67 100644
--- a/lib/arel/engines/sql/relations/utilities/compound.rb
+++ b/lib/arel/engines/sql/relations/utilities/compound.rb
@@ -3,4 +3,4 @@ module Arel
delegate :table, :table_sql, :to => :relation
end
end
- \ No newline at end of file
+
diff --git a/lib/arel/engines/sql/relations/utilities/externalization.rb b/lib/arel/engines/sql/relations/utilities/externalization.rb
index 1ac6f2de8e..7f937e8423 100644
--- a/lib/arel/engines/sql/relations/utilities/externalization.rb
+++ b/lib/arel/engines/sql/relations/utilities/externalization.rb
@@ -11,4 +11,4 @@ module Arel
relation.name + '_external'
end
end
-end \ No newline at end of file
+end
diff --git a/lib/arel/engines/sql/relations/utilities/nil.rb b/lib/arel/engines/sql/relations/utilities/nil.rb
index 77534b25ad..519ea8acf1 100644
--- a/lib/arel/engines/sql/relations/utilities/nil.rb
+++ b/lib/arel/engines/sql/relations/utilities/nil.rb
@@ -3,4 +3,4 @@ module Arel
def table_sql(formatter = nil); '' end
def name; '' end
end
-end \ No newline at end of file
+end
diff --git a/lib/arel/engines/sql/relations/utilities/recursion.rb b/lib/arel/engines/sql/relations/utilities/recursion.rb
index 848b059507..84a526f57c 100644
--- a/lib/arel/engines/sql/relations/utilities/recursion.rb
+++ b/lib/arel/engines/sql/relations/utilities/recursion.rb
@@ -10,4 +10,4 @@ module Arel
end
end
end
-end \ No newline at end of file
+end
diff --git a/lib/arel/engines/sql/relations/writes.rb b/lib/arel/engines/sql/relations/writes.rb
index edfd9f7233..4d753f5fca 100644
--- a/lib/arel/engines/sql/relations/writes.rb
+++ b/lib/arel/engines/sql/relations/writes.rb
@@ -33,4 +33,4 @@ module Arel
].join("\n")
end
end
-end \ No newline at end of file
+end
diff --git a/spec/arel/algebra/unit/predicates/binary_spec.rb b/spec/arel/algebra/unit/predicates/binary_spec.rb
index 9022a543d1..14fd7ab21b 100644
--- a/spec/arel/algebra/unit/predicates/binary_spec.rb
+++ b/spec/arel/algebra/unit/predicates/binary_spec.rb
@@ -9,19 +9,19 @@ module Arel
class ConcreteBinary < Binary
end
end
-
+
describe '#bind' do
before do
@another_relation = @relation.alias
end
-
+
describe 'when both operands are attributes' do
it "manufactures an expression with the attributes bound to the relation" do
ConcreteBinary.new(@attribute1, @attribute2).bind(@another_relation). \
should == ConcreteBinary.new(@another_relation[@attribute1], @another_relation[@attribute2])
end
end
-
+
describe 'when an operand is a value' do
it "manufactures an expression with unmodified values" do
ConcreteBinary.new(@attribute1, "asdf").bind(@another_relation). \
@@ -30,4 +30,4 @@ module Arel
end
end
end
-end \ No newline at end of file
+end
diff --git a/spec/arel/algebra/unit/predicates/equality_spec.rb b/spec/arel/algebra/unit/predicates/equality_spec.rb
index 9a56ed5eaf..af91f8b51b 100644
--- a/spec/arel/algebra/unit/predicates/equality_spec.rb
+++ b/spec/arel/algebra/unit/predicates/equality_spec.rb
@@ -8,20 +8,20 @@ module Arel
@attribute1 = @relation1[:id]
@attribute2 = @relation2[:user_id]
end
-
- describe '==' do
+
+ describe '==' do
it "obtains if attribute1 and attribute2 are identical" do
Equality.new(@attribute1, @attribute2).should == Equality.new(@attribute1, @attribute2)
Equality.new(@attribute1, @attribute2).should_not == Equality.new(@attribute1, @attribute1)
end
-
+
it "obtains if the concrete type of the predicates are identical" do
Equality.new(@attribute1, @attribute2).should_not == Binary.new(@attribute1, @attribute2)
end
-
+
it "is commutative on the attributes" do
Equality.new(@attribute1, @attribute2).should == Equality.new(@attribute2, @attribute1)
end
end
end
-end \ No newline at end of file
+end
diff --git a/spec/arel/algebra/unit/predicates/in_spec.rb b/spec/arel/algebra/unit/predicates/in_spec.rb
index 91c154763c..a8a15ce4e3 100644
--- a/spec/arel/algebra/unit/predicates/in_spec.rb
+++ b/spec/arel/algebra/unit/predicates/in_spec.rb
@@ -7,4 +7,4 @@ module Arel
@attribute = @relation[:id]
end
end
-end \ No newline at end of file
+end
diff --git a/spec/arel/algebra/unit/primitives/attribute_spec.rb b/spec/arel/algebra/unit/primitives/attribute_spec.rb
index dcac5abf65..89e338e377 100644
--- a/spec/arel/algebra/unit/primitives/attribute_spec.rb
+++ b/spec/arel/algebra/unit/primitives/attribute_spec.rb
@@ -6,32 +6,32 @@ module Arel
@relation = Table.new(:users)
@attribute = @relation[:id]
end
-
+
describe Attribute::Transformations do
describe '#as' do
it "manufactures an aliased attributed" do
@attribute.as(:alias).should == Attribute.new(@relation, @attribute.name, :alias => :alias, :ancestor => @attribute)
end
end
-
+
describe '#bind' do
it "manufactures an attribute with the relation bound and self as an ancestor" do
derived_relation = @relation.where(@relation[:id].eq(1))
@attribute.bind(derived_relation).should == Attribute.new(derived_relation, @attribute.name, :ancestor => @attribute)
end
-
+
it "returns self if the substituting to the same relation" do
@attribute.bind(@relation).should == @attribute
end
end
-
+
describe '#to_attribute' do
describe 'when the given relation is the same as the attributes relation' do
it "returns self" do
@attribute.to_attribute(@relation).should == @attribute
end
end
-
+
describe 'when the given relation differs from the attributes relation' do
it 'binds to the new relation' do
@attribute.to_attribute(new_relation = @relation.alias).should == @attribute.bind(new_relation)
@@ -39,32 +39,32 @@ module Arel
end
end
end
-
+
describe '#column' do
it "returns the corresponding column in the relation" do
@attribute.column.should == @relation.column_for(@attribute)
end
end
-
+
describe '#engine' do
it "delegates to its relation" do
Attribute.new(@relation, :id).engine.should == @relation.engine
end
end
-
+
describe Attribute::Congruence do
describe '/' do
before do
@aliased_relation = @relation.alias
@doubly_aliased_relation = @aliased_relation.alias
end
-
+
describe 'when dividing two unrelated attributes' do
it "returns 0.0" do
(@relation[:id] / @relation[:name]).should == 0.0
end
end
-
+
describe 'when dividing two matching attributes' do
it 'returns a the highest score for the most similar attributes' do
(@aliased_relation[:id] / @relation[:id]) \
@@ -75,98 +75,98 @@ module Arel
end
end
end
-
+
describe Attribute::Predications do
before do
@attribute = Attribute.new(@relation, :name)
end
-
+
describe '#eq' do
it "manufactures an equality predicate" do
@attribute.eq('name').should == Equality.new(@attribute, 'name')
end
end
-
+
describe '#lt' do
it "manufactures a less-than predicate" do
@attribute.lt(10).should == LessThan.new(@attribute, 10)
end
end
-
+
describe '#lteq' do
it "manufactures a less-than or equal-to predicate" do
@attribute.lteq(10).should == LessThanOrEqualTo.new(@attribute, 10)
end
end
-
+
describe '#gt' do
it "manufactures a greater-than predicate" do
@attribute.gt(10).should == GreaterThan.new(@attribute, 10)
end
end
-
+
describe '#gteq' do
it "manufactures a greater-than or equal-to predicate" do
@attribute.gteq(10).should == GreaterThanOrEqualTo.new(@attribute, 10)
end
end
-
+
describe '#matches' do
it "manufactures a match predicate" do
@attribute.matches(/.*/).should == Match.new(@attribute, /.*/)
end
end
-
+
describe '#in' do
it "manufactures an in predicate" do
@attribute.in(1..30).should == In.new(@attribute, (1..30))
end
end
end
-
+
describe Attribute::Expressions do
before do
- @attribute = Attribute.new(@relation, :name)
+ @attribute = Attribute.new(@relation, :name)
end
-
+
describe '#count' do
it "manufactures a count Expression" do
@attribute.count.should == Count.new(@attribute)
end
end
-
+
describe '#sum' do
it "manufactures a sum Expression" do
@attribute.sum.should == Sum.new(@attribute)
end
end
-
+
describe '#maximum' do
it "manufactures a maximum Expression" do
@attribute.maximum.should == Maximum.new(@attribute)
end
end
-
+
describe '#minimum' do
it "manufactures a minimum Expression" do
@attribute.minimum.should == Minimum.new(@attribute)
end
end
-
+
describe '#average' do
it "manufactures an average Expression" do
@attribute.average.should == Average.new(@attribute)
end
- end
+ end
end
-
+
describe Attribute::Orderings do
describe '#asc' do
it 'manufactures an ascending ordering' do
pending
end
end
-
+
describe '#desc' do
it 'manufactures a descending ordering' do
pending
@@ -174,4 +174,4 @@ module Arel
end
end
end
-end \ No newline at end of file
+end
diff --git a/spec/arel/algebra/unit/primitives/expression_spec.rb b/spec/arel/algebra/unit/primitives/expression_spec.rb
index dfd2100048..82d12d53f9 100644
--- a/spec/arel/algebra/unit/primitives/expression_spec.rb
+++ b/spec/arel/algebra/unit/primitives/expression_spec.rb
@@ -6,29 +6,29 @@ module Arel
@relation = Table.new(:users)
@attribute = @relation[:id]
end
-
+
describe Expression::Transformations do
before do
@expression = Count.new(@attribute)
end
-
+
describe '#bind' do
it "manufactures an attribute with a rebound relation and self as the ancestor" do
derived_relation = @relation.where(@relation[:id].eq(1))
@expression.bind(derived_relation).should == Count.new(@attribute.bind(derived_relation), nil, @expression)
end
-
+
it "returns self if the substituting to the same relation" do
@expression.bind(@relation).should == @expression
end
end
-
+
describe '#as' do
it "manufactures an aliased expression" do
@expression.as(:alias).should == Expression.new(@attribute, :alias, @expression)
end
end
-
+
describe '#to_attribute' do
it "manufactures an attribute with the expression as an ancestor" do
@expression.to_attribute(@relation).should == Attribute.new(@relation, @expression.alias, :ancestor => @expression)
@@ -36,4 +36,4 @@ module Arel
end
end
end
-end \ No newline at end of file
+end
diff --git a/spec/arel/algebra/unit/primitives/value_spec.rb b/spec/arel/algebra/unit/primitives/value_spec.rb
index 8774ca78c5..45208e6c5d 100644
--- a/spec/arel/algebra/unit/primitives/value_spec.rb
+++ b/spec/arel/algebra/unit/primitives/value_spec.rb
@@ -12,4 +12,4 @@ module Arel
end
end
end
-end \ No newline at end of file
+end
diff --git a/spec/arel/algebra/unit/relations/alias_spec.rb b/spec/arel/algebra/unit/relations/alias_spec.rb
index c87a0ca2dd..a5d716a638 100644
--- a/spec/arel/algebra/unit/relations/alias_spec.rb
+++ b/spec/arel/algebra/unit/relations/alias_spec.rb
@@ -5,7 +5,7 @@ module Arel
before do
@relation = Table.new(:users)
end
-
+
describe '==' do
it "obtains if the objects are the same" do
Alias.new(@relation).should_not == Alias.new(@relation)
@@ -13,4 +13,4 @@ module Arel
end
end
end
-end \ No newline at end of file
+end
diff --git a/spec/arel/algebra/unit/relations/delete_spec.rb b/spec/arel/algebra/unit/relations/delete_spec.rb
index 075e59e724..7578e12a3e 100644
--- a/spec/arel/algebra/unit/relations/delete_spec.rb
+++ b/spec/arel/algebra/unit/relations/delete_spec.rb
@@ -6,4 +6,4 @@ module Arel
@relation = Table.new(:users)
end
end
-end \ No newline at end of file
+end
diff --git a/spec/arel/algebra/unit/relations/group_spec.rb b/spec/arel/algebra/unit/relations/group_spec.rb
index 050de2993d..58f9252356 100644
--- a/spec/arel/algebra/unit/relations/group_spec.rb
+++ b/spec/arel/algebra/unit/relations/group_spec.rb
@@ -7,4 +7,4 @@ module Arel
@attribute = @relation[:id]
end
end
-end \ No newline at end of file
+end
diff --git a/spec/arel/algebra/unit/relations/insert_spec.rb b/spec/arel/algebra/unit/relations/insert_spec.rb
index 184cd2a926..feb1a5eae4 100644
--- a/spec/arel/algebra/unit/relations/insert_spec.rb
+++ b/spec/arel/algebra/unit/relations/insert_spec.rb
@@ -6,4 +6,4 @@ module Arel
@relation = Table.new(:users)
end
end
-end \ No newline at end of file
+end
diff --git a/spec/arel/algebra/unit/relations/join_spec.rb b/spec/arel/algebra/unit/relations/join_spec.rb
index 5b512cc7f6..f5a8bd32aa 100644
--- a/spec/arel/algebra/unit/relations/join_spec.rb
+++ b/spec/arel/algebra/unit/relations/join_spec.rb
@@ -7,14 +7,14 @@ module Arel
@relation2 = Table.new(:photos)
@predicate = @relation1[:id].eq(@relation2[:user_id])
end
-
+
describe 'hashing' do
it 'implements hash equality' do
InnerJoin.new(@relation1, @relation2, @predicate) \
.should hash_the_same_as(InnerJoin.new(@relation1, @relation2, @predicate))
end
end
-
+
describe '#attributes' do
it 'combines the attributes of the two relations' do
join = InnerJoin.new(@relation1, @relation2, @predicate)
@@ -23,4 +23,4 @@ module Arel
end
end
end
-end \ No newline at end of file
+end
diff --git a/spec/arel/algebra/unit/relations/order_spec.rb b/spec/arel/algebra/unit/relations/order_spec.rb
index 0e1b1a0e54..4f163894c8 100644
--- a/spec/arel/algebra/unit/relations/order_spec.rb
+++ b/spec/arel/algebra/unit/relations/order_spec.rb
@@ -8,4 +8,4 @@ module Arel
end
end
end
- \ No newline at end of file
+
diff --git a/spec/arel/algebra/unit/relations/project_spec.rb b/spec/arel/algebra/unit/relations/project_spec.rb
index b71acf5e91..9f4358ea54 100644
--- a/spec/arel/algebra/unit/relations/project_spec.rb
+++ b/spec/arel/algebra/unit/relations/project_spec.rb
@@ -6,24 +6,24 @@ module Arel
@relation = Table.new(:users)
@attribute = @relation[:id]
end
-
+
describe '#attributes' do
before do
@projection = Project.new(@relation, @attribute)
end
-
+
it "manufactures attributes associated with the projection relation" do
@projection.attributes.should == [@attribute].collect { |a| a.bind(@projection) }
end
end
-
+
describe '#externalizable?' do
describe 'when the projections are attributes' do
it 'returns false' do
Project.new(@relation, @attribute).should_not be_externalizable
end
end
-
+
describe 'when the projections include an aggregation' do
it "obtains" do
Project.new(@relation, @attribute.sum).should be_externalizable
@@ -31,4 +31,4 @@ module Arel
end
end
end
-end \ No newline at end of file
+end
diff --git a/spec/arel/algebra/unit/relations/relation_spec.rb b/spec/arel/algebra/unit/relations/relation_spec.rb
index 9707f2887c..adf82847ac 100644
--- a/spec/arel/algebra/unit/relations/relation_spec.rb
+++ b/spec/arel/algebra/unit/relations/relation_spec.rb
@@ -7,14 +7,14 @@ module Arel
@attribute1 = @relation[:id]
@attribute2 = @relation[:name]
end
-
+
describe '[]' do
describe 'when given an', Attribute do
it "return the attribute congruent to the provided attribute" do
@relation[@attribute1].should == @attribute1
end
end
-
+
describe 'when given a', Symbol, String do
it "returns the attribute with the same name, if it exists" do
@relation[:id].should == @attribute1
@@ -23,13 +23,13 @@ module Arel
end
end
end
-
+
describe Relation::Operable do
describe 'joins' do
before do
@predicate = @relation[:id].eq(@relation[:id])
end
-
+
describe '#join' do
describe 'when given a relation' do
it "manufactures an inner join operation between those two relations" do
@@ -37,13 +37,13 @@ module Arel
should == InnerJoin.new(@relation, @relation, @predicate)
end
end
-
+
describe "when given a string" do
it "manufactures a join operation with the string passed through" do
- @relation.join(arbitrary_string = "ASDF").should == StringJoin.new(@relation, arbitrary_string)
+ @relation.join(arbitrary_string = "ASDF").should == StringJoin.new(@relation, arbitrary_string)
end
end
-
+
describe "when given something blank" do
it "returns self" do
@relation.join.should == @relation
@@ -64,7 +64,7 @@ module Arel
@relation.project(@attribute1, @attribute2). \
should == Project.new(@relation, @attribute1, @attribute2)
end
-
+
describe "when given blank attributes" do
it "returns self" do
@relation.project.should == @relation
@@ -97,36 +97,36 @@ module Arel
end
end
end
-
+
describe '#order' do
it "manufactures an order relation" do
@relation.order(@attribute1, @attribute2).should == Order.new(@relation, @attribute1, @attribute2)
end
-
+
describe 'when given a blank ordering' do
it 'returns self' do
@relation.order.should == @relation
end
end
end
-
+
describe '#take' do
it "manufactures a take relation" do
@relation.take(5).should == Take.new(@relation, 5)
end
-
+
describe 'when given a blank number of items' do
it 'returns self' do
@relation.take.should == @relation
end
end
end
-
+
describe '#skip' do
it "manufactures a skip relation" do
@relation.skip(4).should == Skip.new(@relation, 4)
end
-
+
describe 'when given a blank number of items' do
it 'returns self' do
@relation.skip.should == @relation
@@ -138,14 +138,14 @@ module Arel
it 'manufactures a group relation' do
@relation.group(@attribute1, @attribute2).should == Group.new(@relation, @attribute1, @attribute2)
end
-
+
describe 'when given blank groupings' do
it 'returns self' do
@relation.group.should == @relation
end
end
end
-
+
describe Relation::Operable::Writable do
describe '#delete' do
it 'manufactures a deletion relation' do
@@ -177,7 +177,7 @@ module Arel
end
end
end
-
+
describe Relation::Enumerable do
it "implements enumerable" do
@relation.collect.should == @relation.session.read(@relation).collect
@@ -185,4 +185,4 @@ module Arel
end
end
end
-end \ No newline at end of file
+end
diff --git a/spec/arel/algebra/unit/relations/skip_spec.rb b/spec/arel/algebra/unit/relations/skip_spec.rb
index ff57e03d1c..a41913436e 100644
--- a/spec/arel/algebra/unit/relations/skip_spec.rb
+++ b/spec/arel/algebra/unit/relations/skip_spec.rb
@@ -7,4 +7,4 @@ module Arel
@skipped = 4
end
end
-end \ No newline at end of file
+end
diff --git a/spec/arel/algebra/unit/relations/table_spec.rb b/spec/arel/algebra/unit/relations/table_spec.rb
index 4821d92299..dfe457043c 100644
--- a/spec/arel/algebra/unit/relations/table_spec.rb
+++ b/spec/arel/algebra/unit/relations/table_spec.rb
@@ -5,7 +5,7 @@ module Arel
before do
@relation = Table.new(:users)
end
-
+
describe '[]' do
describe 'when given a', Symbol do
it "manufactures an attribute if the symbol names an attribute within the relation" do
@@ -18,22 +18,22 @@ module Arel
it "returns the attribute if the attribute is within the relation" do
@relation[@relation[:id]].should == @relation[:id]
end
-
+
it "returns nil if the attribtue is not within the relation" do
another_relation = Table.new(:photos)
@relation[another_relation[:id]].should be_nil
end
end
-
+
describe 'when given an', Expression do
before do
@expression = @relation[:id].count
end
-
+
it "returns the Expression if the Expression is within the relation" do
@relation[@expression].should be_nil
end
end
end
end
-end \ No newline at end of file
+end
diff --git a/spec/arel/algebra/unit/relations/take_spec.rb b/spec/arel/algebra/unit/relations/take_spec.rb
index 6f8b4fd36e..2bc17db5a1 100644
--- a/spec/arel/algebra/unit/relations/take_spec.rb
+++ b/spec/arel/algebra/unit/relations/take_spec.rb
@@ -7,4 +7,4 @@ module Arel
@taken = 4
end
end
-end \ No newline at end of file
+end
diff --git a/spec/arel/algebra/unit/relations/update_spec.rb b/spec/arel/algebra/unit/relations/update_spec.rb
index c27afb48b2..e9642ffc99 100644
--- a/spec/arel/algebra/unit/relations/update_spec.rb
+++ b/spec/arel/algebra/unit/relations/update_spec.rb
@@ -6,4 +6,4 @@ module Arel
@relation = Table.new(:users)
end
end
-end \ No newline at end of file
+end
diff --git a/spec/arel/algebra/unit/relations/where_spec.rb b/spec/arel/algebra/unit/relations/where_spec.rb
index 3f37b53138..6c3074a3a5 100644
--- a/spec/arel/algebra/unit/relations/where_spec.rb
+++ b/spec/arel/algebra/unit/relations/where_spec.rb
@@ -6,13 +6,13 @@ module Arel
@relation = Table.new(:users)
@predicate = @relation[:id].eq(1)
end
-
+
describe '#initialize' do
it "manufactures nested where relations if multiple predicates are provided" do
- another_predicate = @relation[:name].lt(2)
+ another_predicate = @relation[:name].lt(2)
Where.new(@relation, @predicate, another_predicate). \
should == Where.new(Where.new(@relation, another_predicate), @predicate)
end
end
end
-end \ No newline at end of file
+end
diff --git a/spec/arel/algebra/unit/session/session_spec.rb b/spec/arel/algebra/unit/session/session_spec.rb
index e17b5d638a..ca0a43f278 100644
--- a/spec/arel/algebra/unit/session/session_spec.rb
+++ b/spec/arel/algebra/unit/session/session_spec.rb
@@ -6,7 +6,7 @@ module Arel
@relation = Table.new(:users)
@session = Session.new
end
-
+
describe '::start' do
describe '::instance' do
it "it is a singleton within the started session" do
@@ -23,13 +23,13 @@ module Arel
end
end
end
-
+
it "manufactures new sessions outside of the started session" do
Session.new.should_not == Session.new
end
end
end
-
+
describe Session::CRUD do
before do
@insert = Insert.new(@relation, @relation[:name] => 'nick')
@@ -37,34 +37,34 @@ module Arel
@delete = Deletion.new(@relation)
@read = @relation
end
-
+
describe '#create' do
it "executes an insertion on the connection" do
mock(@insert).call
@session.create(@insert)
end
end
-
+
describe '#read' do
it "executes an selection on the connection" do
mock(@read).call
@session.read(@read)
end
-
+
it "is memoized" do
mock(@read).call.once
@session.read(@read)
@session.read(@read)
end
end
-
+
describe '#update' do
it "executes an update on the connection" do
mock(@update).call
@session.update(@update)
end
end
-
+
describe '#delete' do
it "executes a delete on the connection" do
mock(@delete).call
@@ -72,13 +72,13 @@ module Arel
end
end
end
-
+
describe 'Transactions' do
describe '#begin' do
end
-
+
describe '#end' do
end
end
end
-end \ No newline at end of file
+end
diff --git a/spec/arel/engines/memory/integration/joins/cross_engine_spec.rb b/spec/arel/engines/memory/integration/joins/cross_engine_spec.rb
index 4862300052..bffecc9182 100644
--- a/spec/arel/engines/memory/integration/joins/cross_engine_spec.rb
+++ b/spec/arel/engines/memory/integration/joins/cross_engine_spec.rb
@@ -45,4 +45,4 @@ module Arel
end
end
end
-end \ No newline at end of file
+end
diff --git a/spec/arel/engines/memory/unit/relations/array_spec.rb b/spec/arel/engines/memory/unit/relations/array_spec.rb
index 4fe24c77fa..dd9da41569 100644
--- a/spec/arel/engines/memory/unit/relations/array_spec.rb
+++ b/spec/arel/engines/memory/unit/relations/array_spec.rb
@@ -29,4 +29,4 @@ module Arel
end
end
end
-end \ No newline at end of file
+end
diff --git a/spec/arel/engines/memory/unit/relations/insert_spec.rb b/spec/arel/engines/memory/unit/relations/insert_spec.rb
index 4b5e8833a0..59e43328a3 100644
--- a/spec/arel/engines/memory/unit/relations/insert_spec.rb
+++ b/spec/arel/engines/memory/unit/relations/insert_spec.rb
@@ -9,7 +9,7 @@ module Arel
[3, 'goose']
], [:id, :name])
end
-
+
describe '#call' do
it "manufactures an array of hashes of attributes to values" do
@relation \
@@ -25,4 +25,4 @@ module Arel
end
end
end
-end \ No newline at end of file
+end
diff --git a/spec/arel/engines/memory/unit/relations/join_spec.rb b/spec/arel/engines/memory/unit/relations/join_spec.rb
index 920cc55d0a..df08fd4a96 100644
--- a/spec/arel/engines/memory/unit/relations/join_spec.rb
+++ b/spec/arel/engines/memory/unit/relations/join_spec.rb
@@ -11,7 +11,7 @@ module Arel
@relation2 = @relation1.alias
@relation3 = @relation1.alias
end
-
+
describe InnerJoin do
describe '#call' do
it 'combines the two tables where the predicate obtains' do
@@ -29,4 +29,4 @@ module Arel
end
end
end
-end \ No newline at end of file
+end
diff --git a/spec/arel/engines/memory/unit/relations/order_spec.rb b/spec/arel/engines/memory/unit/relations/order_spec.rb
index 3ecb31068b..1e9690bbbf 100644
--- a/spec/arel/engines/memory/unit/relations/order_spec.rb
+++ b/spec/arel/engines/memory/unit/relations/order_spec.rb
@@ -9,7 +9,7 @@ module Arel
[3, 'goose']
], [:id, :name])
end
-
+
describe '#call' do
it 'sorts the relation with the provided ordering' do
@relation \
@@ -24,4 +24,4 @@ module Arel
end
end
end
-end \ No newline at end of file
+end
diff --git a/spec/arel/engines/memory/unit/relations/project_spec.rb b/spec/arel/engines/memory/unit/relations/project_spec.rb
index 1d1224cfdc..1690910026 100644
--- a/spec/arel/engines/memory/unit/relations/project_spec.rb
+++ b/spec/arel/engines/memory/unit/relations/project_spec.rb
@@ -9,7 +9,7 @@ module Arel
[3, 'goose']
], [:id, :name])
end
-
+
describe '#call' do
it 'retains only the attributes that are provided' do
@relation \
@@ -24,4 +24,4 @@ module Arel
end
end
end
-end \ No newline at end of file
+end
diff --git a/spec/arel/engines/memory/unit/relations/skip_spec.rb b/spec/arel/engines/memory/unit/relations/skip_spec.rb
index 86db45ef61..3411c5493b 100644
--- a/spec/arel/engines/memory/unit/relations/skip_spec.rb
+++ b/spec/arel/engines/memory/unit/relations/skip_spec.rb
@@ -9,7 +9,7 @@ module Arel
[3, 'goose']
], [:id, :name])
end
-
+
describe '#call' do
it 'removes the first n rows' do
@relation \
@@ -23,4 +23,4 @@ module Arel
end
end
end
-end \ No newline at end of file
+end
diff --git a/spec/arel/engines/memory/unit/relations/take_spec.rb b/spec/arel/engines/memory/unit/relations/take_spec.rb
index 8b774987e0..5e7c4fb462 100644
--- a/spec/arel/engines/memory/unit/relations/take_spec.rb
+++ b/spec/arel/engines/memory/unit/relations/take_spec.rb
@@ -9,7 +9,7 @@ module Arel
[3, 'goose']
], [:id, :name])
end
-
+
describe '#call' do
it 'removes the rows after the first n' do
@relation \
@@ -23,4 +23,4 @@ module Arel
end
end
end
-end \ No newline at end of file
+end
diff --git a/spec/arel/engines/memory/unit/relations/where_spec.rb b/spec/arel/engines/memory/unit/relations/where_spec.rb
index d75ee5dcbe..1d2c2eb39c 100644
--- a/spec/arel/engines/memory/unit/relations/where_spec.rb
+++ b/spec/arel/engines/memory/unit/relations/where_spec.rb
@@ -9,7 +9,7 @@ module Arel
[3, 'goose']
], [:id, :name])
end
-
+
describe '#call' do
it 'filters the relation with the provided predicate' do
@relation \
@@ -21,7 +21,7 @@ module Arel
]
end
end
-
+
describe 'when filtering a where relation' do
it 'further filters the already-filtered relation with the provided predicate' do
@relation \
@@ -36,4 +36,4 @@ module Arel
end
end
end
-end \ No newline at end of file
+end
diff --git a/spec/arel/engines/sql/unit/predicates/binary_spec.rb b/spec/arel/engines/sql/unit/predicates/binary_spec.rb
index 679147067e..befd2878d9 100644
--- a/spec/arel/engines/sql/unit/predicates/binary_spec.rb
+++ b/spec/arel/engines/sql/unit/predicates/binary_spec.rb
@@ -102,4 +102,4 @@ module Arel
end
end
end
-end \ No newline at end of file
+end
diff --git a/spec/arel/engines/sql/unit/predicates/equality_spec.rb b/spec/arel/engines/sql/unit/predicates/equality_spec.rb
index e8c8c42675..688a6a20be 100644
--- a/spec/arel/engines/sql/unit/predicates/equality_spec.rb
+++ b/spec/arel/engines/sql/unit/predicates/equality_spec.rb
@@ -43,4 +43,4 @@ module Arel
end
end
end
-end \ No newline at end of file
+end
diff --git a/spec/arel/engines/sql/unit/predicates/in_spec.rb b/spec/arel/engines/sql/unit/predicates/in_spec.rb
index d977937e4e..d3e75cfb84 100644
--- a/spec/arel/engines/sql/unit/predicates/in_spec.rb
+++ b/spec/arel/engines/sql/unit/predicates/in_spec.rb
@@ -83,4 +83,4 @@ module Arel
end
end
end
-end \ No newline at end of file
+end
diff --git a/spec/arel/engines/sql/unit/primitives/attribute_spec.rb b/spec/arel/engines/sql/unit/primitives/attribute_spec.rb
index e71ab949f1..6cb72f3c19 100644
--- a/spec/arel/engines/sql/unit/primitives/attribute_spec.rb
+++ b/spec/arel/engines/sql/unit/primitives/attribute_spec.rb
@@ -12,7 +12,7 @@ module Arel
@attribute.column.should == @relation.column_for(@attribute)
end
end
-
+
describe '#to_sql' do
describe 'for a simple attribute' do
it "manufactures sql with an alias" do
@@ -29,4 +29,4 @@ module Arel
end
end
end
-end \ No newline at end of file
+end
diff --git a/spec/arel/engines/sql/unit/relations/group_spec.rb b/spec/arel/engines/sql/unit/relations/group_spec.rb
index b7279a23d9..5e0c675c8b 100644
--- a/spec/arel/engines/sql/unit/relations/group_spec.rb
+++ b/spec/arel/engines/sql/unit/relations/group_spec.rb
@@ -53,4 +53,4 @@ module Arel
end
end
end
-end \ No newline at end of file
+end
diff --git a/spec/arel/engines/sql/unit/relations/join_spec.rb b/spec/arel/engines/sql/unit/relations/join_spec.rb
index 1f43101133..f904b61870 100644
--- a/spec/arel/engines/sql/unit/relations/join_spec.rb
+++ b/spec/arel/engines/sql/unit/relations/join_spec.rb
@@ -54,4 +54,4 @@ module Arel
end
end
end
-end \ No newline at end of file
+end
diff --git a/spec/arel/engines/sql/unit/relations/skip_spec.rb b/spec/arel/engines/sql/unit/relations/skip_spec.rb
index f8e5ceaad3..c14bd1ce95 100644
--- a/spec/arel/engines/sql/unit/relations/skip_spec.rb
+++ b/spec/arel/engines/sql/unit/relations/skip_spec.rb
@@ -29,4 +29,4 @@ module Arel
end
end
end
-end \ No newline at end of file
+end
diff --git a/spec/arel/engines/sql/unit/relations/table_spec.rb b/spec/arel/engines/sql/unit/relations/table_spec.rb
index 3f5a5ac248..9797b38822 100644
--- a/spec/arel/engines/sql/unit/relations/table_spec.rb
+++ b/spec/arel/engines/sql/unit/relations/table_spec.rb
@@ -66,4 +66,4 @@ module Arel
end
end
end
-end \ No newline at end of file
+end
diff --git a/spec/arel/engines/sql/unit/relations/take_spec.rb b/spec/arel/engines/sql/unit/relations/take_spec.rb
index 1263ed4795..8f1240fc17 100644
--- a/spec/arel/engines/sql/unit/relations/take_spec.rb
+++ b/spec/arel/engines/sql/unit/relations/take_spec.rb
@@ -29,4 +29,4 @@ module Arel
end
end
end
-end \ No newline at end of file
+end
diff --git a/spec/arel/unit/predicates/predicates_spec.rb b/spec/arel/unit/predicates/predicates_spec.rb
index 8f9cec5376..ac842998af 100644
--- a/spec/arel/unit/predicates/predicates_spec.rb
+++ b/spec/arel/unit/predicates/predicates_spec.rb
@@ -50,4 +50,4 @@ module Arel
end
end
end
-end \ No newline at end of file
+end
diff --git a/spec/connections/mysql_connection.rb b/spec/connections/mysql_connection.rb
index 789628b95d..b4e27f2380 100644
--- a/spec/connections/mysql_connection.rb
+++ b/spec/connections/mysql_connection.rb
@@ -10,4 +10,4 @@ ActiveRecord::Base.configurations = {
}
}
-ActiveRecord::Base.establish_connection 'unit' \ No newline at end of file
+ActiveRecord::Base.establish_connection 'unit'
diff --git a/spec/doubles/hash.rb b/spec/doubles/hash.rb
index 97d25742cb..32c5b98058 100644
--- a/spec/doubles/hash.rb
+++ b/spec/doubles/hash.rb
@@ -2,19 +2,19 @@ class Hash
def ordered_array
to_a.sort { |(key1, value1), (key2, value2)| key1.hash <=> key2.hash }
end
-
+
def keys
ordered_array.collect(&:first)
end
-
+
def values
ordered_array.collect { |_, v| v }
end
-
+
def each(&block)
ordered_array.each(&block)
end
-
+
def shift
returning to_a.first do |k, v|
delete(k)
diff --git a/spec/matchers/be_like.rb b/spec/matchers/be_like.rb
index 4ff5bc532f..c9d4d4b979 100644
--- a/spec/matchers/be_like.rb
+++ b/spec/matchers/be_like.rb
@@ -3,22 +3,22 @@ module BeLikeMatcher
def initialize(expected)
@expected = expected
end
-
+
def matches?(actual)
@actual = actual
@expected.gsub(/\s+/, ' ').strip == @actual.gsub(/\s+/, ' ').strip
end
-
+
def failure_message
"expected\n#{@actual}\nto be like\n#{@expected}"
end
-
+
def negative_failure_message
"expected\n#{@actual}\nto be unlike\n#{@expected}"
end
end
-
+
def be_like(expected)
BeLike.new(expected)
end
-end \ No newline at end of file
+end
diff --git a/spec/matchers/disambiguate_attributes.rb b/spec/matchers/disambiguate_attributes.rb
index bee7d22b0c..bc4a5215d4 100644
--- a/spec/matchers/disambiguate_attributes.rb
+++ b/spec/matchers/disambiguate_attributes.rb
@@ -3,7 +3,7 @@ module DisambiguateAttributesMatcher
def initialize(attributes)
@attributes = attributes
end
-
+
def matches?(actual)
@actual = actual
attribute1, attribute2 = @attributes
@@ -11,18 +11,18 @@ module DisambiguateAttributesMatcher
!@actual[attribute1].descends_from?(attribute2) &&
@actual[attribute2].descends_from?(attribute2)
end
-
+
def failure_message
""
# "expected #{@actual} to disambiguate its attributes"
end
-
+
def negative_failure_message
"expected #{@actual} to not disambiguate its attributes"
end
end
-
+
def disambiguate_attributes(*attributes)
DisambiguateAttributes.new(attributes)
end
-end \ No newline at end of file
+end
diff --git a/spec/matchers/hash_the_same_as.rb b/spec/matchers/hash_the_same_as.rb
index c1903b62b4..03e955a0cb 100644
--- a/spec/matchers/hash_the_same_as.rb
+++ b/spec/matchers/hash_the_same_as.rb
@@ -3,24 +3,24 @@ module HashTheSameAsMatcher
def initialize(expected)
@expected = expected
end
-
+
def matches?(actual)
@actual = actual
hash = {}
hash[@expected] = :some_arbitrary_value
hash[@actual] == :some_arbitrary_value
end
-
+
def failure_message
"expected #{@actual} to hash the same as #{@expected}; they must be `eql?` and have the same `#hash` value"
end
-
+
def negative_failure_message
"expected #{@actual} to hash differently than #{@expected}; they must not be `eql?` or have a differing `#hash` values"
end
end
-
+
def hash_the_same_as(expected)
HashTheSameAs.new(expected)
end
-end \ No newline at end of file
+end
diff --git a/spec/schemas/mysql_schema.rb b/spec/schemas/mysql_schema.rb
index 1123f4582e..dc2558fd6a 100644
--- a/spec/schemas/mysql_schema.rb
+++ b/spec/schemas/mysql_schema.rb
@@ -15,4 +15,4 @@ SQL
sql.split(/;/).select(&:present?).each do |sql_statement|
ActiveRecord::Base.connection.execute sql_statement
-end \ No newline at end of file
+end
diff --git a/spec/schemas/sqlite3_schema.rb b/spec/schemas/sqlite3_schema.rb
index 6c98a4f934..94d224520e 100644
--- a/spec/schemas/sqlite3_schema.rb
+++ b/spec/schemas/sqlite3_schema.rb
@@ -15,4 +15,4 @@ SQL
sql.split(/;/).select(&:present?).each do |sql_statement|
ActiveRecord::Base.connection.execute sql_statement
-end \ No newline at end of file
+end