Sha256: 219e94930fa444a7d5ff23480ebc2b326f0fd815cd6f9f6075b4d01b6e3f5cc4
Contents?: true
Size: 998 Bytes
Versions: 4
Compression:
Stored size: 998 Bytes
Contents
# frozen_string_literal: true require "active_support" require_relative "cheesecloth/version" require_relative "cheesecloth/errors" require_relative "cheesecloth/filter" require_relative "cheesecloth/filter_list" require_relative "cheesecloth/wrapper" module CheeseCloth extend ActiveSupport::Concern included do cattr_accessor :cheesecloth_wrapper self.cheesecloth_wrapper = Wrapper.new(self) attr_accessor :scope_override attr_writer :scope end class_methods do def scope(*args) cheesecloth_wrapper.assign_default_scope_proc(*args) end def filter(conditions = nil, &block) cheesecloth_wrapper.filter_list.add_filter(conditions, block) end end def scope @scope || scope_override || cheesecloth_wrapper.scope end def filtered_scope(scope: nil) self.scope_override = scope cheesecloth_wrapper.prepare_and_run(self) self.scope end private def cheesecloth_wrapper self.class.cheesecloth_wrapper end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
cheesecloth-0.1.3 | lib/cheesecloth.rb |
cheesecloth-0.1.2 | lib/cheesecloth.rb |
cheesecloth-0.1.1 | lib/cheesecloth.rb |
cheesecloth-0.1.0 | lib/cheesecloth.rb |