Sha256: 2b80b9b82b264d6fbd7a4a19d64f7b2879278b6ce9b7bfcf5030b3f68e3b2cc0
Contents?: true
Size: 692 Bytes
Versions: 1
Compression:
Stored size: 692 Bytes
Contents
# frozen_string_literal: true module CheeseCloth class Wrapper attr_reader :klass, :filter_list, :scope, :default_scope_proc def initialize(klass) @klass = klass @filter_list = FilterList.new(klass) end def assign_default_scope_proc(block) @default_scope_proc = block end def prepare_and_run(instance) assign_and_check_scope(instance) run(instance) end def assign_and_check_scope(instance) @scope = default_scope_proc && instance.instance_exec(&default_scope_proc) raise MissingScopeError, self.class unless instance.scope end def run(instance) filter_list.run_filters(instance) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
cheesecloth-0.1.3 | lib/cheesecloth/wrapper.rb |