aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/TODO5
-rw-r--r--lib/arel/relations.rb8
-rw-r--r--lib/arel/relations/delete.rb (renamed from lib/arel/relations/deletion.rb)0
-rw-r--r--lib/arel/relations/group.rb (renamed from lib/arel/relations/grouping.rb)4
-rw-r--r--lib/arel/relations/insert.rb (renamed from lib/arel/relations/insertion.rb)4
-rw-r--r--lib/arel/relations/project.rb (renamed from lib/arel/relations/projection.rb)4
-rw-r--r--lib/arel/relations/relation.rb6
-rw-r--r--spec/arel/unit/relations/delete_spec.rb (renamed from spec/arel/unit/relations/deletion_spec.rb)0
-rw-r--r--spec/arel/unit/relations/group_spec.rb (renamed from spec/arel/unit/relations/grouping_spec.rb)6
-rw-r--r--spec/arel/unit/relations/insert_spec.rb (renamed from spec/arel/unit/relations/insertion_spec.rb)12
-rw-r--r--spec/arel/unit/relations/project_spec.rb (renamed from spec/arel/unit/relations/projection_spec.rb)16
-rw-r--r--spec/arel/unit/relations/relation_spec.rb6
-rw-r--r--spec/arel/unit/session/session_spec.rb2
13 files changed, 37 insertions, 36 deletions
diff --git a/doc/TODO b/doc/TODO
index 4b27d03c4c..8d805d9f72 100644
--- a/doc/TODO
+++ b/doc/TODO
@@ -1,5 +1,4 @@
todo:
-- rename select to where
- and/or w/ predicates
- blocks for all operations
- result sets to attr correlation too
@@ -18,7 +17,7 @@ done:
. Attribute == Attribute -> EqualityPredicate
. Attribute >= Attribute -> GreaterThanOrEqualToPredicate
. Relation.include?(Column) -> Predicate
-. Relation.project(*Column) -> ProjectionRelation
+. Relation.project(*Column) -> ProjectRelation
. Relation.select(*Predicate) -> SelectionRelation
. Relation.order(*Column) -> OrderRelation
. #to_sql
@@ -67,6 +66,8 @@ done:
- All Sql Strategies should be accumulations with the top-level relation?
- instance methodify externalize
- test: find_attribute_given_attribute and all @attribute ||= everywhere and memoization of table class.
+- rename select to where
+- rename all ion classes
icebox:
- #bind in Attribute and Expression should be doing a descend?
diff --git a/lib/arel/relations.rb b/lib/arel/relations.rb
index b606be3743..364235fb49 100644
--- a/lib/arel/relations.rb
+++ b/lib/arel/relations.rb
@@ -6,14 +6,14 @@ require 'arel/relations/writing'
require 'arel/relations/table'
require 'arel/relations/aggregation'
require 'arel/relations/join'
-require 'arel/relations/grouping'
-require 'arel/relations/projection'
+require 'arel/relations/group'
+require 'arel/relations/project'
require 'arel/relations/where'
require 'arel/relations/order'
require 'arel/relations/take'
require 'arel/relations/skip'
-require 'arel/relations/deletion'
-require 'arel/relations/insertion'
+require 'arel/relations/delete'
+require 'arel/relations/insert'
require 'arel/relations/update'
require 'arel/relations/alias'
require 'arel/sessions/session' \ No newline at end of file
diff --git a/lib/arel/relations/deletion.rb b/lib/arel/relations/delete.rb
index 7edc328e4a..7edc328e4a 100644
--- a/lib/arel/relations/deletion.rb
+++ b/lib/arel/relations/delete.rb
diff --git a/lib/arel/relations/grouping.rb b/lib/arel/relations/group.rb
index de8643278b..bc3a7f3437 100644
--- a/lib/arel/relations/grouping.rb
+++ b/lib/arel/relations/group.rb
@@ -1,5 +1,5 @@
module Arel
- class Grouping < Compound
+ class Group < Compound
attr_reader :groupings
def initialize(relation, *groupings)
@@ -7,7 +7,7 @@ module Arel
end
def ==(other)
- Grouping === other and
+ Group === other and
relation == other.relation and
groupings == other.groupings
end
diff --git a/lib/arel/relations/insertion.rb b/lib/arel/relations/insert.rb
index 16eb9b7555..b190ccb211 100644
--- a/lib/arel/relations/insertion.rb
+++ b/lib/arel/relations/insert.rb
@@ -1,5 +1,5 @@
module Arel
- class Insertion < Writing
+ class Insert < Writing
attr_reader :record
def initialize(relation, record)
@@ -20,7 +20,7 @@ module Arel
end
def ==(other)
- Insertion === other and
+ Insert === other and
relation == other.relation and
record == other.record
end
diff --git a/lib/arel/relations/projection.rb b/lib/arel/relations/project.rb
index d74f111271..0efc13bdb3 100644
--- a/lib/arel/relations/projection.rb
+++ b/lib/arel/relations/project.rb
@@ -1,5 +1,5 @@
module Arel
- class Projection < Compound
+ class Project < Compound
attr_reader :projections
def initialize(relation, *projections)
@@ -15,7 +15,7 @@ module Arel
end
def ==(other)
- Projection === other and
+ Project === other and
relation == other.relation and
projections == other.projections
end
diff --git a/lib/arel/relations/relation.rb b/lib/arel/relations/relation.rb
index 1ef7874f39..4440fb1c1d 100644
--- a/lib/arel/relations/relation.rb
+++ b/lib/arel/relations/relation.rb
@@ -77,7 +77,7 @@ module Arel
end
def project(*attributes)
- attributes.all?(&:blank?) ? self : Projection.new(self, *attributes)
+ attributes.all?(&:blank?) ? self : Project.new(self, *attributes)
end
def alias
@@ -97,12 +97,12 @@ module Arel
end
def group(*groupings)
- groupings.all?(&:blank?) ? self : Grouping.new(self, *groupings)
+ groupings.all?(&:blank?) ? self : Group.new(self, *groupings)
end
module Writable
def insert(record)
- session.create Insertion.new(self, record); self
+ session.create Insert.new(self, record); self
end
def update(assignments)
diff --git a/spec/arel/unit/relations/deletion_spec.rb b/spec/arel/unit/relations/delete_spec.rb
index 46c2ec9143..46c2ec9143 100644
--- a/spec/arel/unit/relations/deletion_spec.rb
+++ b/spec/arel/unit/relations/delete_spec.rb
diff --git a/spec/arel/unit/relations/grouping_spec.rb b/spec/arel/unit/relations/group_spec.rb
index 5f781727cf..a0147b9416 100644
--- a/spec/arel/unit/relations/grouping_spec.rb
+++ b/spec/arel/unit/relations/group_spec.rb
@@ -1,7 +1,7 @@
require File.join(File.dirname(__FILE__), '..', '..', '..', 'spec_helper')
module Arel
- describe Grouping do
+ describe Group do
before do
@relation = Table.new(:users)
@attribute = @relation[:id]
@@ -10,7 +10,7 @@ module Arel
describe '#to_sql' do
describe 'when given a predicate' do
it "manufactures sql with where clause conditions" do
- Grouping.new(@relation, @attribute).to_sql.should be_like("
+ Group.new(@relation, @attribute).to_sql.should be_like("
SELECT `users`.`id`, `users`.`name`
FROM `users`
GROUP BY `users`.`id`
@@ -20,7 +20,7 @@ module Arel
describe 'when given a string' do
it "passes the string through to the where clause" do
- Grouping.new(@relation, 'asdf').to_sql.should be_like("
+ Group.new(@relation, 'asdf').to_sql.should be_like("
SELECT `users`.`id`, `users`.`name`
FROM `users`
GROUP BY asdf
diff --git a/spec/arel/unit/relations/insertion_spec.rb b/spec/arel/unit/relations/insert_spec.rb
index 10b70a2036..b983e545a4 100644
--- a/spec/arel/unit/relations/insertion_spec.rb
+++ b/spec/arel/unit/relations/insert_spec.rb
@@ -1,7 +1,7 @@
require File.join(File.dirname(__FILE__), '..', '..', '..', 'spec_helper')
module Arel
- describe Insertion do
+ describe Insert do
before do
@relation = Table.new(:users)
end
@@ -9,7 +9,7 @@ module Arel
describe '#to_sql' do
it 'manufactures sql inserting data when given multiple rows' do
pending 'it should insert multiple rows'
- @insertion = Insertion.new(@relation, [@relation[:name] => "nick", @relation[:name] => "bryan"])
+ @insertion = Insert.new(@relation, [@relation[:name] => "nick", @relation[:name] => "bryan"])
@insertion.to_sql.should be_like("
INSERT
@@ -19,7 +19,7 @@ module Arel
end
it 'manufactures sql inserting data when given multiple values' do
- @insertion = Insertion.new(@relation, @relation[:id] => "1", @relation[:name] => "nick")
+ @insertion = Insert.new(@relation, @relation[:id] => "1", @relation[:name] => "nick")
@insertion.to_sql.should be_like("
INSERT
@@ -30,7 +30,7 @@ module Arel
describe 'when given values whose types correspond to the types of the attributes' do
before do
- @insertion = Insertion.new(@relation, @relation[:name] => "nick")
+ @insertion = Insert.new(@relation, @relation[:name] => "nick")
end
it 'manufactures sql inserting data' do
@@ -44,7 +44,7 @@ module Arel
describe 'when given values whose types differ from from the types of the attributes' do
before do
- @insertion = Insertion.new(@relation, @relation[:id] => '1-asdf')
+ @insertion = Insert.new(@relation, @relation[:id] => '1-asdf')
end
it 'manufactures sql inserting data' do
@@ -59,7 +59,7 @@ module Arel
describe '#call' do
before do
- @insertion = Insertion.new(@relation, @relation[:name] => "nick")
+ @insertion = Insert.new(@relation, @relation[:name] => "nick")
end
it 'executes an insert on the connection' do
diff --git a/spec/arel/unit/relations/projection_spec.rb b/spec/arel/unit/relations/project_spec.rb
index 3c6a092db5..2a4b690dd8 100644
--- a/spec/arel/unit/relations/projection_spec.rb
+++ b/spec/arel/unit/relations/project_spec.rb
@@ -1,7 +1,7 @@
require File.join(File.dirname(__FILE__), '..', '..', '..', 'spec_helper')
module Arel
- describe Projection do
+ describe Project do
before do
@relation = Table.new(:users)
@attribute = @relation[:id]
@@ -9,7 +9,7 @@ module Arel
describe '#attributes' do
before do
- @projection = Projection.new(@relation, @attribute)
+ @projection = Project.new(@relation, @attribute)
end
it "manufactures attributes associated with the projection relation" do
@@ -20,7 +20,7 @@ module Arel
describe '#to_sql' do
describe 'when given an attribute' do
it "manufactures sql with a limited select clause" do
- Projection.new(@relation, @attribute).to_sql.should be_like("
+ Project.new(@relation, @attribute).to_sql.should be_like("
SELECT `users`.`id`
FROM `users`
")
@@ -29,11 +29,11 @@ module Arel
describe 'when given a relation' do
before do
- @scalar_relation = Projection.new(@relation, @relation[:name])
+ @scalar_relation = Project.new(@relation, @relation[:name])
end
it "manufactures sql with scalar selects" do
- Projection.new(@relation, @scalar_relation).to_sql.should be_like("
+ Project.new(@relation, @scalar_relation).to_sql.should be_like("
SELECT (SELECT `users`.`name` FROM `users`) AS `users` FROM `users`
")
end
@@ -41,7 +41,7 @@ module Arel
describe 'when given a string' do
it "passes the string through to the select clause" do
- Projection.new(@relation, 'asdf').to_sql.should be_like("
+ Project.new(@relation, 'asdf').to_sql.should be_like("
SELECT asdf FROM `users`
")
end
@@ -60,13 +60,13 @@ module Arel
describe '#aggregation?' do
describe 'when the projections are attributes' do
it 'returns false' do
- Projection.new(@relation, @attribute).should_not be_aggregation
+ Project.new(@relation, @attribute).should_not be_aggregation
end
end
describe 'when the projections include an aggregation' do
it "obtains" do
- Projection.new(@relation, @attribute.sum).should be_aggregation
+ Project.new(@relation, @attribute.sum).should be_aggregation
end
end
end
diff --git a/spec/arel/unit/relations/relation_spec.rb b/spec/arel/unit/relations/relation_spec.rb
index 78e391640e..77a787b840 100644
--- a/spec/arel/unit/relations/relation_spec.rb
+++ b/spec/arel/unit/relations/relation_spec.rb
@@ -62,7 +62,7 @@ module Arel
describe '#project' do
it "manufactures a projection relation" do
@relation.project(@attribute1, @attribute2). \
- should == Projection.new(@relation, @attribute1, @attribute2)
+ should == Project.new(@relation, @attribute1, @attribute2)
end
describe "when given blank attributes" do
@@ -136,7 +136,7 @@ module Arel
describe '#group' do
it 'manufactures a group relation' do
- @relation.group(@attribute1, @attribute2).should == Grouping.new(@relation, @attribute1, @attribute2)
+ @relation.group(@attribute1, @attribute2).should == Group.new(@relation, @attribute1, @attribute2)
end
describe 'when given blank groupings' do
@@ -160,7 +160,7 @@ module Arel
it 'manufactures an insertion relation' do
Session.start do
record = {@relation[:name] => 'carl'}
- mock(Session.new).create(Insertion.new(@relation, record))
+ mock(Session.new).create(Insert.new(@relation, record))
@relation.insert(record).should == @relation
end
end
diff --git a/spec/arel/unit/session/session_spec.rb b/spec/arel/unit/session/session_spec.rb
index fbb2b7791b..7582aa35e1 100644
--- a/spec/arel/unit/session/session_spec.rb
+++ b/spec/arel/unit/session/session_spec.rb
@@ -32,7 +32,7 @@ module Arel
describe Session::CRUD do
before do
- @insert = Insertion.new(@relation, @relation[:name] => 'nick')
+ @insert = Insert.new(@relation, @relation[:name] => 'nick')
@update = Update.new(@relation, @relation[:name] => 'nick')
@delete = Deletion.new(@relation)
@read = @relation