module Sequel::IdentifierMangling::DatasetMethods

Public Instance Methods

identifier_input_method() click to toggle source

The String instance method to call on identifiers before sending them to the database.

# File lib/sequel/extensions/identifier_mangling.rb, line 133
def identifier_input_method
  @opts.fetch(:identifier_input_method, db.identifier_input_method)
end
identifier_output_method() click to toggle source

The String instance method to call on identifiers before sending them to the database.

# File lib/sequel/extensions/identifier_mangling.rb, line 139
def identifier_output_method
  @opts.fetch(:identifier_output_method, db.identifier_output_method)
end
quote_identifiers?() click to toggle source

Check with the database to see if identifier quoting is enabled

# File lib/sequel/extensions/identifier_mangling.rb, line 144
def quote_identifiers?
  @opts.fetch(:quote_identifiers, db.quote_identifiers?)
end
with_identifier_input_method(meth) click to toggle source

Return a modified dataset with #identifier_input_method set.

# File lib/sequel/extensions/identifier_mangling.rb, line 149
def with_identifier_input_method(meth)
  clone(:identifier_input_method=>meth, :skip_symbol_cache=>true)
end
with_identifier_output_method(meth) click to toggle source

Return a modified dataset with #identifier_output_method set.

# File lib/sequel/extensions/identifier_mangling.rb, line 154
def with_identifier_output_method(meth)
  clone(:identifier_output_method=>meth)
end

Private Instance Methods

input_identifier(v) click to toggle source

Convert the identifier to the version used in the database via identifier_input_method.

# File lib/sequel/extensions/identifier_mangling.rb, line 162
def input_identifier(v)
  (i = identifier_input_method) ? v.to_s.public_send(i) : v.to_s
end
non_sql_option?(key) click to toggle source
Calls superclass method
# File lib/sequel/extensions/identifier_mangling.rb, line 173
def non_sql_option?(key)
  super || key == :identifier_input_method || key == :identifier_output_method
end
output_identifier(v) click to toggle source

Modify the identifier returned from the database based on the identifier_output_method.

# File lib/sequel/extensions/identifier_mangling.rb, line 168
def output_identifier(v)
  v = 'untitled' if v == ''
  (i = identifier_output_method) ? v.to_s.public_send(i).to_sym : v.to_sym
end