diff options
author | Nick Kallen <nkallen@nick-kallens-computer-2.local> | 2008-03-12 23:31:18 -0700 |
---|---|---|
committer | Nick Kallen <nkallen@nick-kallens-computer-2.local> | 2008-03-12 23:31:18 -0700 |
commit | b1acebaaf0823c093853ade5700bbf5117b4f31a (patch) | |
tree | afb68e6d23f032802854e396e5f988aa1642c4d3 /lib | |
parent | 2654c29bfdb2ccddfed8cceaaaba06e46892bdb9 (diff) | |
download | rails-b1acebaaf0823c093853ade5700bbf5117b4f31a.tar.gz rails-b1acebaaf0823c093853ade5700bbf5117b4f31a.tar.bz2 rails-b1acebaaf0823c093853ade5700bbf5117b4f31a.zip |
- renamed scalar to value
- added better test coverage and documentation of binary spec #to_sql
Diffstat (limited to 'lib')
-rw-r--r-- | lib/active_relation/extensions/array.rb | 2 | ||||
-rw-r--r-- | lib/active_relation/extensions/object.rb | 2 | ||||
-rw-r--r-- | lib/active_relation/primitives.rb | 2 | ||||
-rw-r--r-- | lib/active_relation/primitives/value.rb (renamed from lib/active_relation/primitives/scalar.rb) | 6 | ||||
-rw-r--r-- | lib/active_relation/sql.rb | 14 |
5 files changed, 13 insertions, 13 deletions
diff --git a/lib/active_relation/extensions/array.rb b/lib/active_relation/extensions/array.rb index aa4354a78a..4bd20d8121 100644 --- a/lib/active_relation/extensions/array.rb +++ b/lib/active_relation/extensions/array.rb @@ -2,7 +2,7 @@ class Array def to_hash Hash[*flatten] end - + def to_sql(strategy = nil) "(#{collect(&:to_sql).join(', ')})" end diff --git a/lib/active_relation/extensions/object.rb b/lib/active_relation/extensions/object.rb index c1269ee37b..ab874150ed 100644 --- a/lib/active_relation/extensions/object.rb +++ b/lib/active_relation/extensions/object.rb @@ -8,7 +8,7 @@ class Object end def bind(relation) - ActiveRelation::Scalar.new(self, relation) + ActiveRelation::Value.new(self, relation) end def metaclass diff --git a/lib/active_relation/primitives.rb b/lib/active_relation/primitives.rb index 7629256034..9909734d24 100644 --- a/lib/active_relation/primitives.rb +++ b/lib/active_relation/primitives.rb @@ -1,4 +1,4 @@ require 'active_relation/primitives/attribute' -require 'active_relation/primitives/scalar' +require 'active_relation/primitives/value' require 'active_relation/primitives/expression' diff --git a/lib/active_relation/primitives/scalar.rb b/lib/active_relation/primitives/value.rb index d428541a50..ce9497cf34 100644 --- a/lib/active_relation/primitives/scalar.rb +++ b/lib/active_relation/primitives/value.rb @@ -1,5 +1,5 @@ module ActiveRelation - class Scalar + class Value attr_reader :value, :relation def initialize(value, relation) @@ -7,11 +7,11 @@ module ActiveRelation end def to_sql(strategy = Sql::Predicate.new(relation.engine)) - strategy.scalar value + strategy.value value end def format(object) - object.to_sql(Sql::Scalar.new(relation.engine)) + object.to_sql(Sql::Value.new(relation.engine)) end def ==(other) diff --git a/lib/active_relation/sql.rb b/lib/active_relation/sql.rb index ff00223ce7..fb2177a55b 100644 --- a/lib/active_relation/sql.rb +++ b/lib/active_relation/sql.rb @@ -29,8 +29,8 @@ module ActiveRelation "#{quote_table_name(relation_name)}.#{quote_column_name(attribute_name)}" end - def scalar(scalar, column = nil) - quote(scalar, column) + def value(value, column = nil) + quote(value, column) end def select(select_sql, aliaz) @@ -39,8 +39,8 @@ module ActiveRelation end class Selection < Formatter - def scalar(scalar) - scalar + def value(value) + value end end @@ -61,12 +61,12 @@ module ActiveRelation @attribute, @engine = attribute, attribute.engine end - def scalar(scalar) - quote(scalar, @attribute.column) + def value(value) + quote(value, @attribute.column) end end - class Scalar < Predicate + class Value < Predicate end end end
\ No newline at end of file |