Module: Rack::MogileFS::Endpoint::Client
- Included in:
- Rack::MogileFS::Endpoint
- Defined in:
- lib/rack/mogilefs/endpoint/client.rb
Overview
Provides a default client if one is not passed in a a param. It is recommended to use the default client if you can
Instance Method Summary collapse
-
#config ⇒ Object
If ‘Rack::MogileFS` detects it is inside a Rails app, it will look for a yaml config in `config/mogilefs.yml` that looks like this:.
- #default_client ⇒ Object
- #initialize ⇒ Object
Instance Method Details
#config ⇒ Object
If ‘Rack::MogileFS` detects it is inside a Rails app, it will look for a yaml config in `config/mogilefs.yml` that looks like this:
development:
connection:
domain: "development.myapp.com"
hosts:
- 127.0.0.1:7001
- 127.0.0.1:7001
class: "file"
staging:
...
29 30 31 32 33 34 35 36 |
# File 'lib/rack/mogilefs/endpoint/client.rb', line 29 def config if defined?(Rails) yml = YAML.load_file( Rails.root.join("config/mogilefs.yml") ) yml[Rails.env]["connection"].symbolize_keys else { :domain => "default", :hosts => ["127.0.0.1:7001"] } end end |
#default_client ⇒ Object
13 14 15 |
# File 'lib/rack/mogilefs/endpoint/client.rb', line 13 def default_client ::MogileFS::MogileFS.new(config) end |
#initialize ⇒ Object
8 9 10 11 |
# File 'lib/rack/mogilefs/endpoint/client.rb', line 8 def initialize(*) super @options[:client] ||= lambda { default_client } end |