Module Sequel::Plugins::InvertedSubsets
In: lib/sequel/plugins/inverted_subsets.rb

The inverted_subsets plugin adds another method for each defined subset, which inverts the condition supplied. By default, inverted subset method names are prefixed with not_.

You can change the prefix, or indeed entirely customise the inverted names, by passing a block to the plugin configuration:

  # Use an exclude_ prefix for inverted subsets instead of not_
  Album.plugin(:inverted_subsets){|name| "exclude_#{name}"}

Usage:

  # Add inverted subsets in the Album class
  Album.plugin :inverted_subsets

  # This will now create two methods, published and not_published
  Album.subset :published, :published => true

  Album.published.sql
  # SELECT * FROM albums WHERE (published IS TRUE)

  Album.not_published.sql
  # SELECT * FROM albums WHERE (published IS NOT TRUE)

Methods

configure  

Classes and Modules

Module Sequel::Plugins::InvertedSubsets::ClassMethods

Constants

DEFAULT_NAME_BLOCK = lambda{|name| "not_#{name}"}   Default naming for inverted subsets

Public Class methods

Store the supplied block for calling later when subsets are defined, or create a default one if we need to.

[Source]

    # File lib/sequel/plugins/inverted_subsets.rb, line 35
35:       def self.configure(model, &block)
36:         model.instance_variable_set(:@inverted_subsets_name_block, block || DEFAULT_NAME_BLOCK)
37:       end

[Validate]