Sha256: 426d4ad256d1d70df6fc69d0f757237f6b97c4cd49e837c8a2bf91a3f56c7344

Contents?: true

Size: 493 Bytes

Versions: 19

Compression:

Stored size: 493 Bytes

Contents

class Card::Query::Spec
  attr_accessor :spec

  def safe_sql(txt)
    txt = txt.to_s
    txt.match( /[^\w\*\(\)\s\.\,]/ ) ? raise( "WQL contains disallowed characters: #{txt}" ) : txt
  end

  def quote(v)  ActiveRecord::Base.connection.quote(v)  end

  def match_prep(v,cardspec=self)
    cxn ||= ActiveRecord::Base.connection
    [cxn, v]
  end

  def cast_type(type)
    cxn ||= ActiveRecord::Base.connection
    (val = cxn.cast_types[type.to_sym]) ? val[:name] : safe_sql(type)
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
wagn-1.14.4 lib/card/query/spec.rb
wagn-1.14.3 lib/card/query/spec.rb
wagn-1.14.2 lib/card/query/spec.rb
wagn-1.14.1 lib/card/query/spec.rb
wagn-1.14.0 lib/card/query/spec.rb
wagn-1.14.0.pre3 lib/card/query/spec.rb
wagn-1.14.0.pre2 lib/card/query/spec.rb
wagn-1.14.0.pre1 lib/card/query/spec.rb
wagn-1.13.0 lib/card/query/spec.rb
wagn-1.13.0.pre2 lib/card/query/spec.rb
wagn-1.13.0.pre1 lib/card/query/spec.rb
wagn-1.13.0.pre lib/card/query/spec.rb
wagn-1.12.13 lib/card/query/spec.rb
wagn-1.12.12 lib/card/query/spec.rb
wagn-1.12.11 lib/card/query/spec.rb
wagn-1.12.10 lib/card/query/spec.rb
wagn-1.12.9 lib/card/query/spec.rb
wagn-1.12.8 lib/card/query/spec.rb
wagn-1.12.7 lib/card/query/spec.rb