Class: Auther::Settings

Inherits:
Object
  • Object
show all
Defined in:
lib/auther/settings.rb

Overview

Represents Auther settings.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(title: "Authorization", label: "Authorization", secret: "", accounts: [], auth_url: "/login", logger: Auther::NullLogger.new(STDOUT)) ⇒ Settings

rubocop:disable Metrics/ParameterLists



9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/auther/settings.rb', line 9

def initialize title: "Authorization",
               label: "Authorization",
               secret: "",
               accounts: [],
               auth_url: "/login",
               logger: Auther::NullLogger.new(STDOUT)

  @title = title
  @label = label
  @secret = secret
  @accounts = accounts
  @auth_url = auth_url
  @logger = logger
end

Instance Attribute Details

#accountsObject (readonly)

Returns the value of attribute accounts.



6
7
8
# File 'lib/auther/settings.rb', line 6

def accounts
  @accounts
end

#auth_urlObject (readonly)

Returns the value of attribute auth_url.



6
7
8
# File 'lib/auther/settings.rb', line 6

def auth_url
  @auth_url
end

#labelObject (readonly)

Returns the value of attribute label.



6
7
8
# File 'lib/auther/settings.rb', line 6

def label
  @label
end

#loggerObject (readonly)

Returns the value of attribute logger.



6
7
8
# File 'lib/auther/settings.rb', line 6

def logger
  @logger
end

#secretObject (readonly)

Returns the value of attribute secret.



6
7
8
# File 'lib/auther/settings.rb', line 6

def secret
  @secret
end

#titleObject (readonly)

Returns the value of attribute title.



6
7
8
# File 'lib/auther/settings.rb', line 6

def title
  @title
end

Instance Method Details

#find_account(name) ⇒ Object

rubocop:enable Metrics/ParameterLists



25
26
27
# File 'lib/auther/settings.rb', line 25

def  name
  accounts.find { || .fetch(:name) == name }
end