Class: Qinium::Config
- Inherits:
-
Configurable
- Object
- Hash
- Configurable
- Qinium::Config
- Defined in:
- lib/qinium/config.rb
Instance Method Summary collapse
- #fetch_host(bucket = self.bucket, opts = {}) ⇒ Object
-
#initialize(options = {}) ⇒ Config
constructor
A new instance of Config.
- #put_policy_options ⇒ Object
- #up_host(bucket = self.bucket) ⇒ Object
Methods inherited from Configurable
#[]=, #method_missing, #respond_to_missing?
Constructor Details
#initialize(options = {}) ⇒ Config
Returns a new instance of Config.
3 4 5 6 7 8 9 10 11 |
# File 'lib/qinium/config.rb', line 3 def initialize( = {}) [:protocol] ||= :https = if [:protocol] == :http .merge() else .merge() end super(.merge()) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Qinium::Configurable
Instance Method Details
#fetch_host(bucket = self.bucket, opts = {}) ⇒ Object
22 23 24 |
# File 'lib/qinium/config.rb', line 22 def fetch_host(bucket = self.bucket, opts = {}) self[:fetch_host] || HostManager.new(self).fetch_host(bucket, opts) end |
#put_policy_options ⇒ Object
26 27 28 |
# File 'lib/qinium/config.rb', line 26 def @put_policy_options ||= self[:put_policy_options] || Configurable.new end |
#up_host(bucket = self.bucket) ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/qinium/config.rb', line 13 def up_host(bucket = self.bucket) raw = self[:up_host] unless raw.to_s.strip.empty? normalize_qiniu_up_base_url(raw.to_s) else HostManager.new(self).up_host(bucket) end end |