Sha256: 8d8d1e9e9c37a3cdd3d5f9382e7cc70904ca0d990e1f921af202b81d86f34c06
Contents?: true
Size: 748 Bytes
Versions: 1
Compression:
Stored size: 748 Bytes
Contents
module CustomClass =begin The REST-Interface does not work with "select from SomeClass where a_property like 'pattern%' " This is rewritten as SomeClass.like "name = D*", order: 'asc' The order-argument is optional, "asc" is the default. This Primitiv-Version only accepts the wildcards "*" and "%" at the end of the seach-string. The Wildcard can be omitted. The method does not accept further arguments. =end def like operation, order: 'asc' # remove all spaces and split the resulting word p, s = operation.gsub(/\s+/, "").split("=") if ["%","*"].include?(s[-1]) s.chop! end q = OrientSupport::OrientQuery.new where: { "#{p}.left(#{s.length})" => s } ,order: { p => order } query_database q end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
active-orient-0.79 | lib/model/custom.rb |