From b1acebaaf0823c093853ade5700bbf5117b4f31a Mon Sep 17 00:00:00 2001 From: Nick Kallen Date: Wed, 12 Mar 2008 23:31:18 -0700 Subject: - renamed scalar to value - added better test coverage and documentation of binary spec #to_sql --- lib/active_relation/primitives/value.rb | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 lib/active_relation/primitives/value.rb (limited to 'lib/active_relation/primitives/value.rb') diff --git a/lib/active_relation/primitives/value.rb b/lib/active_relation/primitives/value.rb new file mode 100644 index 0000000000..ce9497cf34 --- /dev/null +++ b/lib/active_relation/primitives/value.rb @@ -0,0 +1,25 @@ +module ActiveRelation + class Value + attr_reader :value, :relation + + def initialize(value, relation) + @value, @relation = value, relation + end + + def to_sql(strategy = Sql::Predicate.new(relation.engine)) + strategy.value value + end + + def format(object) + object.to_sql(Sql::Value.new(relation.engine)) + end + + def ==(other) + value == other.value + end + + def qualify + self + end + end +end \ No newline at end of file -- cgit v1.2.3