Class: Reeve::Authorization::Current::State

Inherits:
Object
  • Object
show all
Defined in:
lib/reeve/authorization/current.rb

Overview

Mutable for exactly two reasons: recording that scoped was used, and the size of what it scoped. Everything else about an invocation is fixed when it starts.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(context:, declaration:, adapter:) ⇒ State

Returns a new instance of State.



48
49
50
51
52
53
54
# File 'lib/reeve/authorization/current.rb', line 48

def initialize(context:, declaration:, adapter:)
  @context = context
  @declaration = declaration
  @adapter = adapter
  @scoped_used = false
  @scoped_source_count = nil
end

Instance Attribute Details

#adapterObject (readonly)

Returns the value of attribute adapter.



45
46
47
# File 'lib/reeve/authorization/current.rb', line 45

def adapter
  @adapter
end

#contextObject (readonly)

Returns the value of attribute context.



45
46
47
# File 'lib/reeve/authorization/current.rb', line 45

def context
  @context
end

#declarationObject (readonly)

Returns the value of attribute declaration.



45
46
47
# File 'lib/reeve/authorization/current.rb', line 45

def declaration
  @declaration
end

#scoped_source_countObject

Returns the value of attribute scoped_source_count.



46
47
48
# File 'lib/reeve/authorization/current.rb', line 46

def scoped_source_count
  @scoped_source_count
end

Instance Method Details

#scoped_used!Object



56
57
58
# File 'lib/reeve/authorization/current.rb', line 56

def scoped_used!
  @scoped_used = true
end

#scoped_used?Boolean

Returns:

  • (Boolean)


60
61
62
# File 'lib/reeve/authorization/current.rb', line 60

def scoped_used?
  @scoped_used
end