Module | Sequel::Postgres::InetDatabaseMethods
In: | lib/sequel/extensions/pg_inet.rb

Methods enabling Database object integration with the inet/cidr types.

### Methods

bound_variable_arg extended schema_column_type

### Public Class methods

extended(db)

Reset the conversion procs when extending the Database object, so it will pick up the inet/cidr converter. Also, extend the datasets with support for literalizing the IPAddr types.

[Source]

        # File lib/sequel/extensions/pg_inet.rb, line 40
    40:       def self.extended(db)
    41:         db.extend_datasets(InetDatasetMethods)
    42:       end

### Public Instance methods

bound_variable_arg(arg, conn)

Convert an IPAddr arg to a string. Probably not necessary, but done for safety.

[Source]

        # File lib/sequel/extensions/pg_inet.rb, line 46
    46:       def bound_variable_arg(arg, conn)
    47:         case arg
    48:         when IPAddr
    49:           "#{arg.to_s}/#{arg.instance_variable_get(:@mask_addr).to_s(2).count('1')}"
    50:         else
    51:           super
    52:         end
    53:       end

schema_column_type(db_type)

Make the column type detection recognize the inet and cidr types.

[Source]

        # File lib/sequel/extensions/pg_inet.rb, line 56
    56:       def schema_column_type(db_type)
    57:         case db_type
    58:         when 'inet', 'cidr'
    59:           :ipaddr
    60:         else
    61:           super
    62:         end
    63:       end

[Validate]