Module: Ddr::HasContent
- Extended by:
- ActiveSupport::Concern
- Included in:
- Attachment, Component, Target
- Defined in:
- app/models/concerns/ddr/has_content.rb
Instance Method Summary collapse
- #content_human_size ⇒ Object (also: #content_size_human)
- #content_major_type ⇒ Object
- #content_size ⇒ Object
- #content_sub_type ⇒ Object
- #content_type ⇒ Object
- #image? ⇒ Boolean
- #pdf? ⇒ Boolean
- #techmd ⇒ Object
Instance Method Details
#content_human_size ⇒ Object Also known as: content_size_human
20 21 22 |
# File 'app/models/concerns/ddr/has_content.rb', line 20 def content_human_size ActiveSupport::NumberHelper.number_to_human_size(content_size) if content_size end |
#content_major_type ⇒ Object
29 30 31 |
# File 'app/models/concerns/ddr/has_content.rb', line 29 def content_major_type content_type&.split("/")&.first end |
#content_size ⇒ Object
16 17 18 |
# File 'app/models/concerns/ddr/has_content.rb', line 16 def content_size content&.file&.size end |
#content_sub_type ⇒ Object
33 34 35 |
# File 'app/models/concerns/ddr/has_content.rb', line 33 def content_sub_type content_type&.split("/")&.last end |
#content_type ⇒ Object
25 26 27 |
# File 'app/models/concerns/ddr/has_content.rb', line 25 def content_type content&.media_type end |
#image? ⇒ Boolean
37 38 39 |
# File 'app/models/concerns/ddr/has_content.rb', line 37 def image? content_major_type == "image" end |
#pdf? ⇒ Boolean
41 42 43 |
# File 'app/models/concerns/ddr/has_content.rb', line 41 def pdf? content_type == "application/pdf" end |
#techmd ⇒ Object
12 13 14 |
# File 'app/models/concerns/ddr/has_content.rb', line 12 def techmd @techmd ||= Ddr::Managers::TechnicalMetadataManager.new(self) end |