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.
352 353 354 |
# File 'app/controllers/gluttonberg/admin/asset_library/assets_controller.rb', line 352 def content_type @content_type end |
#original_filename ⇒ Object
Returns the value of attribute original_filename.
352 353 354 |
# File 'app/controllers/gluttonberg/admin/asset_library/assets_controller.rb', line 352 def original_filename @original_filename end |
#size ⇒ Object
Returns the value of attribute size.
352 353 354 |
# File 'app/controllers/gluttonberg/admin/asset_library/assets_controller.rb', line 352 def size @size end |
Class Method Details
.find_content_type(filename) ⇒ Object
365 366 367 368 369 370 371 |
# File 'app/controllers/gluttonberg/admin/asset_library/assets_controller.rb', line 365 def self.find_content_type(filename) begin MIME::Types.type_for(filename).first.content_type rescue "" end end |
.init(filename, entry) ⇒ Object
354 355 356 357 358 359 360 |
# File 'app/controllers/gluttonberg/admin/asset_library/assets_controller.rb', line 354 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
362 363 364 |
# File 'app/controllers/gluttonberg/admin/asset_library/assets_controller.rb', line 362 def tempfile self end |