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.



52
53
54
55
# File 'lib/bosh/director/api/extensions/scoping.rb', line 52

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

Instance Method Details

#scope(params, default_scope) ⇒ Object



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

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