diff options
author | Bryan Helmkamp <bryan@brynary.com> | 2009-05-17 16:20:40 -0400 |
---|---|---|
committer | Bryan Helmkamp <bryan@brynary.com> | 2009-05-17 16:20:40 -0400 |
commit | dc7b51883b1cc8ad7e525b7315fb575ae77a5b3d (patch) | |
tree | 97f5e4d55baa45f9805eb36a2196bcc12094ae3a /lib/arel/algebra | |
parent | 19b2af181009acfcb24d156ca350c148630e6787 (diff) | |
download | rails-dc7b51883b1cc8ad7e525b7315fb575ae77a5b3d.tar.gz rails-dc7b51883b1cc8ad7e525b7315fb575ae77a5b3d.tar.bz2 rails-dc7b51883b1cc8ad7e525b7315fb575ae77a5b3d.zip |
Whitespace
Diffstat (limited to 'lib/arel/algebra')
-rw-r--r-- | lib/arel/algebra/extensions/array.rb | 4 | ||||
-rw-r--r-- | lib/arel/algebra/extensions/class.rb | 10 | ||||
-rw-r--r-- | lib/arel/algebra/extensions/hash.rb | 2 | ||||
-rw-r--r-- | lib/arel/algebra/extensions/pathname.rb | 2 | ||||
-rw-r--r-- | lib/arel/algebra/extensions/symbol.rb | 2 | ||||
-rw-r--r-- | lib/arel/algebra/predicates.rb | 2 | ||||
-rw-r--r-- | lib/arel/algebra/primitives/attribute.rb | 8 | ||||
-rw-r--r-- | lib/arel/algebra/primitives/ordering.rb | 8 | ||||
-rw-r--r-- | lib/arel/algebra/relations.rb | 2 | ||||
-rw-r--r-- | lib/arel/algebra/relations/operations/alias.rb | 2 | ||||
-rw-r--r-- | lib/arel/algebra/relations/operations/group.rb | 2 | ||||
-rw-r--r-- | lib/arel/algebra/relations/operations/join.rb | 4 | ||||
-rw-r--r-- | lib/arel/algebra/relations/operations/order.rb | 4 | ||||
-rw-r--r-- | lib/arel/algebra/relations/operations/skip.rb | 4 | ||||
-rw-r--r-- | lib/arel/algebra/relations/operations/take.rb | 4 | ||||
-rw-r--r-- | lib/arel/algebra/relations/row.rb | 10 | ||||
-rw-r--r-- | lib/arel/algebra/relations/utilities/compound.rb | 2 | ||||
-rw-r--r-- | lib/arel/algebra/relations/writes.rb | 10 |
18 files changed, 41 insertions, 41 deletions
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 |