Class: Qbrick::Asset

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/qbrick/asset.rb

Instance Method Summary collapse

Instance Method Details

#file_typeObject



6
7
8
9
10
11
# File 'app/models/qbrick/asset.rb', line 6

def file_type
  return unless file.path.present?

  ext = File.extname(file.path).split('.').last
  ext.to_sym if ext.present?
end

#filenameObject



25
26
27
# File 'app/models/qbrick/asset.rb', line 25

def filename
  try(:file).try(:file).try(:filename)
end

#nameObject



13
14
15
# File 'app/models/qbrick/asset.rb', line 13

def name
  File.basename(file.path) if file.present? && file.path.present?
end

#pathObject



17
18
19
# File 'app/models/qbrick/asset.rb', line 17

def path
  file.url
end

#path=(_val) ⇒ Object



21
22
23
# File 'app/models/qbrick/asset.rb', line 21

def path=(_val)
  # do nothing
end