Class: Riddl::Utils::OAuth2::Helper::Tokens::File
- Inherits:
-
Object
- Object
- Riddl::Utils::OAuth2::Helper::Tokens::File
- Defined in:
- lib/ruby/riddl/utils/oauth2-helper.rb
Overview
}}}
Instance Method Summary collapse
- #[](key) ⇒ Object
- #delete(token) ⇒ Object
- #each ⇒ Object
- #get(key) ⇒ Object
-
#initialize(tfile) ⇒ File
constructor
{{{.
- #key?(key) ⇒ Boolean
- #set(key, value, dur) ⇒ Object
Constructor Details
#initialize(tfile) ⇒ File
{{{
58 59 60 61 62 |
# File 'lib/ruby/riddl/utils/oauth2-helper.rb', line 58 def initialize(tfile) @tfile = tfile @changed = changed read end |
Instance Method Details
#[](key) ⇒ Object
64 65 66 |
# File 'lib/ruby/riddl/utils/oauth2-helper.rb', line 64 def [](key) get(key) end |
#delete(token) ⇒ Object
116 117 118 119 120 |
# File 'lib/ruby/riddl/utils/oauth2-helper.rb', line 116 def delete(token) deleted = @tokens.delete(token) write deleted end |
#each ⇒ Object
73 74 75 76 77 78 79 80 81 |
# File 'lib/ruby/riddl/utils/oauth2-helper.rb', line 73 def each if block_given? @tokens.each do |k,v| yield k,v end else @tokens.each end end |
#get(key) ⇒ Object
68 69 70 71 |
# File 'lib/ruby/riddl/utils/oauth2-helper.rb', line 68 def get(key) read if changed != @changed @tokens[key] end |
#key?(key) ⇒ Boolean
83 84 85 |
# File 'lib/ruby/riddl/utils/oauth2-helper.rb', line 83 def key?(key) @tokens.key?(key) end |
#set(key, value, dur) ⇒ Object
87 88 89 90 91 |
# File 'lib/ruby/riddl/utils/oauth2-helper.rb', line 87 def set(key,value,dur) @tokens[key] = value write nil end |