Class: Bosh::Director::Api::Extensions::Scoping::ParamsScope

Inherits:
Object
  • Object
show all
Defined in:
lib/bosh/director/api/extensions/scoping.rb

Instance Method Summary collapse

Constructor Details

#initialize(name, scope) ⇒ ParamsScope

Returns a new instance of ParamsScope.



55
56
57
58
# File 'lib/bosh/director/api/extensions/scoping.rb', line 55

def initialize(name, scope)
  @name = name.to_s
  @scope = scope
end

Instance Method Details

#scope(params, default_scope) ⇒ Object



60
61
62
63
# File 'lib/bosh/director/api/extensions/scoping.rb', line 60

def scope(params, default_scope)
  scope_name = params.fetch(@name, :default).to_sym
  @scope.fetch(scope_name, default_scope)
end