Class: MyFile
- Inherits:
-
File
- Object
- File
- MyFile
- Defined in:
- app/controllers/gluttonberg/admin/asset_library/assets_controller.rb
Overview
but we are adding assets from file, i am injecting extra attributes manually. because asset library assumes that file has three extra attributes
Instance Attribute Summary collapse
-
#content_type ⇒ Object
Returns the value of attribute content_type.
-
#original_filename ⇒ Object
Returns the value of attribute original_filename.
-
#size ⇒ Object
Returns the value of attribute size.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#content_type ⇒ Object
Returns the value of attribute content_type.
344 345 346 |
# File 'app/controllers/gluttonberg/admin/asset_library/assets_controller.rb', line 344 def content_type @content_type end |
#original_filename ⇒ Object
Returns the value of attribute original_filename.
344 345 346 |
# File 'app/controllers/gluttonberg/admin/asset_library/assets_controller.rb', line 344 def original_filename @original_filename end |
#size ⇒ Object
Returns the value of attribute size.
344 345 346 |
# File 'app/controllers/gluttonberg/admin/asset_library/assets_controller.rb', line 344 def size @size end |
Class Method Details
.find_content_type(filename) ⇒ Object
357 358 359 360 361 362 363 |
# File 'app/controllers/gluttonberg/admin/asset_library/assets_controller.rb', line 357 def self.find_content_type(filename) begin MIME::Types.type_for(filename).first.content_type rescue "" end end |
.init(filename, entry) ⇒ Object
346 347 348 349 350 351 352 |
# File 'app/controllers/gluttonberg/admin/asset_library/assets_controller.rb', line 346 def self.init(filename , entry) file = MyFile.new(filename) file.original_filename = filename file.content_type = find_content_type(filename) file.size = entry.size file end |
Instance Method Details
#tempfile ⇒ Object
354 355 356 |
# File 'app/controllers/gluttonberg/admin/asset_library/assets_controller.rb', line 354 def tempfile self end |