Module: PDC::Resource::Scopes::ClassMethods

Defined in:
lib/pdc/resource/scopes.rb

Instance Method Summary collapse

Instance Method Details

#current_scopeObject



20
21
22
# File 'lib/pdc/resource/scopes.rb', line 20

def current_scope
  ScopeRegistry.value_for(:current_scope, name)
end

#current_scope=(value) ⇒ Object



16
17
18
# File 'lib/pdc/resource/scopes.rb', line 16

def current_scope=(value)
  ScopeRegistry.set_value_for(:current_scope, name, value)
end

#scope(name, code) ⇒ Object



12
13
14
# File 'lib/pdc/resource/scopes.rb', line 12

def scope(name, code)
  define_singleton_method name, code
end

#scopedObject



8
9
10
# File 'lib/pdc/resource/scopes.rb', line 8

def scoped
  current_scope || Relation.new(self, uri: uri)
end