Module: DHS::Record::Scope::ClassMethods

Defined in:
lib/dhs/concerns/record/scope.rb

Instance Method Summary collapse

Instance Method Details

#scope(name, block) ⇒ Object



12
13
14
15
16
17
# File 'lib/dhs/concerns/record/scope.rb', line 12

def scope(name, block)
  scopes[name] = block
  define_singleton_method(name) do |*args|
    block.call(*args)
  end
end

#scopesObject



19
20
21
22
# File 'lib/dhs/concerns/record/scope.rb', line 19

def scopes
  @scopes ||= {}
  @scopes
end