Class: CloudFile::Address
- Includes:
- FromHash
- Defined in:
- lib/cloud_file/address.rb
Instance Attribute Summary collapse
-
#loc ⇒ Object
Returns the value of attribute loc.
-
#provider ⇒ Object
Returns the value of attribute provider.
-
#user ⇒ Object
Returns the value of attribute user.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#loc ⇒ Object
Returns the value of attribute loc.
6 7 8 |
# File 'lib/cloud_file/address.rb', line 6 def loc @loc end |
#provider ⇒ Object
Returns the value of attribute provider.
6 7 8 |
# File 'lib/cloud_file/address.rb', line 6 def provider @provider end |
#user ⇒ Object
Returns the value of attribute user.
6 7 8 |
# File 'lib/cloud_file/address.rb', line 6 def user @user end |
Class Method Details
.make(ops) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/cloud_file/address.rb', line 30 def make(ops) if ops[:loc] new(ops) else res = new res.user = ops.delete(:user) res.provider = ops.delete(:provider) res.loc = ops res end end |
.parse(str) ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/cloud_file/address.rb', line 22 def parse(str) raise "bad #{str}" unless str =~ /^(.+):\/\/(.+)$/ service_class = ::CloudFile::Services.service_class($1) loc = service_class.uri_parser.parse(str) provider = loc.delete('provider') make(:provider => provider, :user => Tokens.user, :loc => loc) end |
Instance Method Details
#files ⇒ Object
17 18 19 |
# File 'lib/cloud_file/address.rb', line 17 def files service.files end |
#open(&b) ⇒ Object
13 14 15 |
# File 'lib/cloud_file/address.rb', line 13 def open(&b) service.open(loc,&b) end |
#service ⇒ Object
8 9 10 11 |
# File 'lib/cloud_file/address.rb', line 8 def service cls = ::CloudFile::Services.service_class(provider) cls.for_user(user) end |