Class: TextFile
- Defined in:
- app/models/file_asset.rb
Direct Known Subclasses
DocFile, DocxFile, HtmlFile, Javascript, Pdf, Ppt, Pptx, Stylesheet, Template, Xls, XmlFile
Instance Method Summary collapse
Methods inherited from FileAsset
acceptable?, adjust_image, all_valid_extensions, apply_filters, #basename, #check_name_uniqueness, #copy, #extname, #fully_qualified_url, #get_contents, #initialize, #is_secured?, #move, #path, #save_dimensions, scope_by_dba_organization, scope_by_party, #set_content_type, #set_data_file_name, #set_sti, split_path, #to_data_hash, #to_s, #trim_name, type_by_extension, type_for, #url, valid_extensions, validate_extension
Constructor Details
This class inherits a constructor from FileAsset
Instance Method Details
#data=(data) ⇒ Object
416 417 418 419 |
# File 'app/models/file_asset.rb', line 416 def data=(data) data = StringIO.new(data) if data.is_a?(String) super end |
#text ⇒ Object
421 422 423 |
# File 'app/models/file_asset.rb', line 421 def text @text ||= ::File.read(path) rescue '' end |
#thumbnail_src ⇒ Object
425 426 427 |
# File 'app/models/file_asset.rb', line 425 def thumbnail_src "#{ErpTechSvcs::Config.file_protocol}://#{File.join(ErpTechSvcs::Config.installation_domain, 'assets/default_file.png')}" end |