Class: BetterAuth::RequestState::State

Inherits:
Struct
  • Object
show all
Defined in:
lib/better_auth/request_state.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#initializerObject

Returns the value of attribute initializer

Returns:

  • (Object)

    the current value of initializer



7
8
9
# File 'lib/better_auth/request_state.rb', line 7

def initializer
  @initializer
end

#refObject

Returns the value of attribute ref

Returns:

  • (Object)

    the current value of ref



7
8
9
# File 'lib/better_auth/request_state.rb', line 7

def ref
  @ref
end

Instance Method Details

#getObject



8
9
10
11
12
# File 'lib/better_auth/request_state.rb', line 8

def get
  store = RequestState.current_store
  store[ref] = initializer.call unless store.key?(ref)
  store[ref]
end

#set(value) ⇒ Object



14
15
16
# File 'lib/better_auth/request_state.rb', line 14

def set(value)
  RequestState.current_store[ref] = value
end