Sha256: d64e78c65d5ff82047f0f3d8afa3e4fd7571c20df895159f3010cce0514d1284

Contents?: true

Size: 464 Bytes

Versions: 6

Compression:

Stored size: 464 Bytes

Contents

module CloudSesame
	module Query
		module AST
			class StringValue < Abstract::Value

				SINGLE_QUATE = Regexp.new(/\'/).freeze
        ESCAPE_QUATE = "\\'".freeze

				def self.parse(value)
					new value.to_s if value
				end

				def to_ary
					compile.split(' ')
				end

				private

				def recompile(value)
					super escape value.to_s
				end

				def escape(value)
				  "'#{ value.gsub(SINGLE_QUATE) { ESCAPE_QUATE } }'"
				end

			end
		end
	end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
CloudSesame-1.0.0 lib/cloud_sesame/query/ast/string_value.rb
CloudSesame-0.9.4 lib/cloud_sesame/query/ast/string_value.rb
CloudSesame-0.9.3 lib/cloud_sesame/query/ast/string_value.rb
CloudSesame-0.9.2 lib/cloud_sesame/query/ast/string_value.rb
CloudSesame-0.9.1 lib/cloud_sesame/query/ast/string_value.rb
CloudSesame-0.9.0 lib/cloud_sesame/query/ast/string_value.rb