Class: Preseason::Config::Authentication

Inherits:
Object
  • Object
show all
Includes:
Preseason::Config
Defined in:
lib/preseason/config/authentication.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Preseason::Colorize

#ask, #readme, #yes?

Methods included from GeneratorContext

#method_missing

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Preseason::GeneratorContext

Instance Attribute Details

#libraryObject

Returns the value of attribute library.



6
7
8
# File 'lib/preseason/config/authentication.rb', line 6

def library
  @library
end

Instance Method Details

#active_admin?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/preseason/config/authentication.rb', line 16

def active_admin?
  library == :active_admin
end

#ask_userObject



8
9
10
11
12
13
14
# File 'lib/preseason/config/authentication.rb', line 8

def ask_user
  if yes? "Will you be using ActiveAdmin? [y/n]"
    self.library = :active_admin
  elsif yes? "Ok then, how about Devise? [y/n]"
    self.library = :devise
  end
end

#devise?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/preseason/config/authentication.rb', line 20

def devise?
  library == :devise || active_admin?
end