Class: Sequel::Postgres::AutoParameterize::StringWithArray
- Defined in:
- lib/sequel/extensions/pg_auto_parameterize.rb
Overview
String that holds an array of parameters
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
The array of parameters used by this query.
Instance Method Summary collapse
-
#add_arg(s, type) ⇒ Object
Add a new parameter to this query, which adds the parameter to the array of parameters, and an SQL placeholder to the query itself.
-
#inspect ⇒ Object
Show args when the string is inspected.
Methods inherited from String
#blank?, #camelize, #classify, #constantize, #dasherize, #demodulize, #foreign_key, #humanize, inflections, #lit, #pluralize, #singularize, #tableize, #titleize, #to_date, #to_datetime, #to_sequel_blob, #to_sequel_time, #to_time, #underscore
Methods included from SQL::CastMethods
#cast, #cast_numeric, #cast_string
Methods included from SQL::AliasMethods
Instance Attribute Details
#args ⇒ Object (readonly)
The array of parameters used by this query.
70 71 72 |
# File 'lib/sequel/extensions/pg_auto_parameterize.rb', line 70 def args @args end |
Instance Method Details
#add_arg(s, type) ⇒ Object
Add a new parameter to this query, which adds the parameter to the array of parameters, and an SQL placeholder to the query itself.
75 76 77 78 79 |
# File 'lib/sequel/extensions/pg_auto_parameterize.rb', line 75 def add_arg(s, type) @args ||= [] @args << s self << "$#{@args.length}::#{type}" end |
#inspect ⇒ Object
Show args when the string is inspected
82 83 84 |
# File 'lib/sequel/extensions/pg_auto_parameterize.rb', line 82 def inspect @args ? "#{self}; #{@args.inspect}".inspect : super end |