aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJiri Pospisil <mekishizufu@gmail.com>2014-06-14 23:23:36 +0200
committerJiri Pospisil <mekishizufu@gmail.com>2014-06-14 23:23:36 +0200
commit0a7e0ef210e30e5f7a69ffe469faf62bdf57bd5c (patch)
tree7516a7b366273c695d50edb0b47187fa6d3f245d /lib
parent9ea4d4689711d86777715360da47ae25c0acc337 (diff)
downloadrails-0a7e0ef210e30e5f7a69ffe469faf62bdf57bd5c.tar.gz
rails-0a7e0ef210e30e5f7a69ffe469faf62bdf57bd5c.tar.bz2
rails-0a7e0ef210e30e5f7a69ffe469faf62bdf57bd5c.zip
Collectors: Introduce PlainString and make use of it in SQLString
Diffstat (limited to 'lib')
-rw-r--r--lib/arel/collectors/plain_string.rb18
-rw-r--r--lib/arel/collectors/sql_string.rb17
2 files changed, 21 insertions, 14 deletions
diff --git a/lib/arel/collectors/plain_string.rb b/lib/arel/collectors/plain_string.rb
new file mode 100644
index 0000000000..2505bc376e
--- /dev/null
+++ b/lib/arel/collectors/plain_string.rb
@@ -0,0 +1,18 @@
+module Arel
+ module Collectors
+ class PlainString
+ def initialize
+ @str = ''
+ end
+
+ def value
+ @str
+ end
+
+ def << str
+ @str << str
+ self
+ end
+ end
+ end
+end
diff --git a/lib/arel/collectors/sql_string.rb b/lib/arel/collectors/sql_string.rb
index 45001bb507..8ca89ca7bd 100644
--- a/lib/arel/collectors/sql_string.rb
+++ b/lib/arel/collectors/sql_string.rb
@@ -1,21 +1,10 @@
# encoding: utf-8
+require 'arel/collectors/plain_string'
+
module Arel
module Collectors
- class SQLString
- def initialize
- @str = ''
- end
-
- def value
- @str
- end
-
- def << str
- @str << str
- self
- end
-
+ class SQLString < PlainString
def add_bind bind
self << bind.to_s
self