Class: Baidupan::Config
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Class Method Summary collapse
- .file_path(*files) ⇒ Object
- .join_path(*files) ⇒ Object
- .method_missing(method, *args) ⇒ Object
- .other_api_path(api) ⇒ Object
- .single_instance ⇒ Object
- .thumbnail ⇒ Object
- .time_format ⇒ Object
Methods inherited from Hash
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
10 11 12 |
# File 'lib/baidupan/config.rb', line 10 def config @config end |
Class Method Details
.file_path(*files) ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/baidupan/config.rb', line 22 def file_path(*files) base_file = File.join(self.base_url, 'file') files.each do |file| base_file = File.join(base_file, file.to_s) end base_file end |
.join_path(*files) ⇒ Object
43 44 45 46 47 |
# File 'lib/baidupan/config.rb', line 43 def join_path(*files) files.inject(self.app_root) do |rpath, lpath| File.join(rpath, lpath.to_s) end end |
.method_missing(method, *args) ⇒ Object
18 19 20 |
# File 'lib/baidupan/config.rb', line 18 def method_missing(method, *args) single_instance.config[method.to_sym] end |
.other_api_path(api) ⇒ Object
35 36 37 |
# File 'lib/baidupan/config.rb', line 35 def other_api_path(api) File.join(self.base_url, api.to_s) end |
.single_instance ⇒ Object
14 15 16 |
# File 'lib/baidupan/config.rb', line 14 def single_instance @_instance ||= new end |
.thumbnail ⇒ Object
31 32 33 |
# File 'lib/baidupan/config.rb', line 31 def thumbnail File.join(self.base_url, "thumbnail") end |
.time_format ⇒ Object
39 40 41 |
# File 'lib/baidupan/config.rb', line 39 def time_format "%Y%m%d%H%M%S" end |