Module: Card::Auth::Setup
- Included in:
- Card::Auth
- Defined in:
- lib/card/auth/setup.rb
Overview
singleton methods for managing setup state
Constant Summary collapse
- NEEDS_SETUP =
"NEEDS_SETUP".freeze
Instance Method Summary collapse
- #instant_account_activation ⇒ Object
-
#needs_setup? ⇒ true/false
app is not totally set up yet.
-
#simulate_setup!(mode = true) ⇒ Object
for testing setup.
Instance Method Details
#instant_account_activation ⇒ Object
24 25 26 27 28 29 |
# File 'lib/card/auth/setup.rb', line 24 def instant_account_activation simulate_needs_setup! yield ensure simulate_needs_setup! false end |
#needs_setup? ⇒ true/false
app is not totally set up yet
9 10 11 12 13 14 15 |
# File 'lib/card/auth/setup.rb', line 9 def needs_setup? if @needs_setup == false || Card.cache.read(NEEDS_SETUP)&.to_s == "false" @needs_setup = false else needs_setup_if_no_accounts end end |
#simulate_setup!(mode = true) ⇒ Object
for testing setup
18 19 20 21 22 |
# File 'lib/card/auth/setup.rb', line 18 def simulate_setup! mode=true Card.cache.delete NEEDS_SETUP @needs_setup = nil @hidden_accounts = mode ? user_account_ids : nil end |