Class: Procore::Auth::Stores::File
- Inherits:
-
Object
- Object
- Procore::Auth::Stores::File
- Defined in:
- lib/procore/auth/stores/file.rb
Instance Attribute Summary collapse
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #delete ⇒ Object
- #fetch ⇒ Object
-
#initialize(key:, path:) ⇒ File
constructor
A new instance of File.
- #save(token) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(key:, path:) ⇒ File
Returns a new instance of File.
8 9 10 11 12 |
# File 'lib/procore/auth/stores/file.rb', line 8 def initialize(key:, path:) @key = key @path = path @store = YAML::Store.new(path) end |
Instance Attribute Details
#key ⇒ Object (readonly)
Returns the value of attribute key.
7 8 9 |
# File 'lib/procore/auth/stores/file.rb', line 7 def key @key end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
7 8 9 |
# File 'lib/procore/auth/stores/file.rb', line 7 def path @path end |
Instance Method Details
#delete ⇒ Object
22 23 24 |
# File 'lib/procore/auth/stores/file.rb', line 22 def delete @store.transaction { @store.delete(key) } end |
#fetch ⇒ Object
18 19 20 |
# File 'lib/procore/auth/stores/file.rb', line 18 def fetch @store.transaction { @store[key] } end |
#save(token) ⇒ Object
14 15 16 |
# File 'lib/procore/auth/stores/file.rb', line 14 def save(token) @store.transaction { @store[key] = token } end |
#to_s ⇒ Object
26 27 28 |
# File 'lib/procore/auth/stores/file.rb', line 26 def to_s "File, Key: #{key}, Path: #{path}" end |