Class: Ask::Auth::Providers::File
- Inherits:
-
Object
- Object
- Ask::Auth::Providers::File
- Defined in:
- lib/ask/auth/providers/file.rb
Overview
Constant Summary collapse
- DEFAULT_PATH =
"~/.ask/credentials.yml"
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
The path this provider reads from.
Instance Method Summary collapse
-
#call(name, user: nil) ⇒ Object
Returns the credential value from the YAML file, or nil.
-
#initialize(path: DEFAULT_PATH) ⇒ File
constructor
A new instance of File.
Constructor Details
#initialize(path: DEFAULT_PATH) ⇒ File
Returns a new instance of File.
18 19 20 |
# File 'lib/ask/auth/providers/file.rb', line 18 def initialize(path: DEFAULT_PATH) @path = path end |
Instance Attribute Details
#path ⇒ Object (readonly)
The path this provider reads from.
32 33 34 |
# File 'lib/ask/auth/providers/file.rb', line 32 def path @path end |
Instance Method Details
#call(name, user: nil) ⇒ Object
Returns the credential value from the YAML file, or nil.
23 24 25 26 27 28 29 |
# File 'lib/ask/auth/providers/file.rb', line 23 def call(name, user: nil) data = load_file return nil unless data value = data[name.to_s] || data[name.to_sym] value end |