Class: RuboCop::RemoteConfig
- Inherits:
-
Object
- Object
- RuboCop::RemoteConfig
- Defined in:
- lib/rubocop/remote_config.rb
Overview
Common methods and behaviors for dealing with remote config files.
Constant Summary collapse
- CACHE_LIFETIME =
24 * 60 * 60
Instance Method Summary collapse
- #file ⇒ Object
-
#initialize(url, base_dir) ⇒ RemoteConfig
constructor
A new instance of RemoteConfig.
Constructor Details
#initialize(url, base_dir) ⇒ RemoteConfig
Returns a new instance of RemoteConfig.
12 13 14 15 |
# File 'lib/rubocop/remote_config.rb', line 12 def initialize(url, base_dir) @uri = URI.parse(url) @base_dir = base_dir end |
Instance Method Details
#file ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/rubocop/remote_config.rb', line 17 def file return cache_path unless cache_path_expired? request do |response| open cache_path, 'w' do |io| io.write response.body end end cache_path end |