Class: Rack::MogileFS::Endpoint::File
- Inherits:
-
Object
- Object
- Rack::MogileFS::Endpoint::File
- Defined in:
- lib/rack/mogilefs/endpoint.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#path ⇒ Object
Returns the value of attribute path.
Instance Method Summary collapse
- #content_type(default = nil) ⇒ Object
- #extname ⇒ Object
-
#initialize(path, data) ⇒ File
constructor
A new instance of File.
- #length ⇒ Object
Constructor Details
#initialize(path, data) ⇒ File
Returns a new instance of File.
15 16 17 |
# File 'lib/rack/mogilefs/endpoint.rb', line 15 def initialize(path, data) @path, @data = path, data end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
13 14 15 |
# File 'lib/rack/mogilefs/endpoint.rb', line 13 def data @data end |
#path ⇒ Object
Returns the value of attribute path.
13 14 15 |
# File 'lib/rack/mogilefs/endpoint.rb', line 13 def path @path end |
Instance Method Details
#content_type(default = nil) ⇒ Object
27 28 29 |
# File 'lib/rack/mogilefs/endpoint.rb', line 27 def content_type(default=nil) Mime.mime_type(extname, default) end |
#extname ⇒ Object
19 20 21 |
# File 'lib/rack/mogilefs/endpoint.rb', line 19 def extname ::File.extname(@path) end |
#length ⇒ Object
23 24 25 |
# File 'lib/rack/mogilefs/endpoint.rb', line 23 def length Utils.bytesize(@data).to_s end |