Class: WebpageArchivist::Image
- Inherits:
-
Sequel::Model
- Object
- Sequel::Model
- WebpageArchivist::Image
- Includes:
- WebpageElement
- Defined in:
- lib/webpage-archivist/models.rb
Class Method Summary collapse
Instance Method Summary collapse
Methods included from ElementWithContent
Class Method Details
.compress ⇒ Object
131 132 133 |
# File 'lib/webpage-archivist/models.rb', line 131 def self.compress false end |
.extention(uri, content_type) ⇒ Object
144 145 146 147 |
# File 'lib/webpage-archivist/models.rb', line 144 def self.extention uri, content_type extension = MIME::Types[content_type].andand[0].extensions.andand[0] extension ? ".#{extension}" : File.extname(Addressable::URI.parse(uri).normalize.path)[0...10] end |
Instance Method Details
#file_name ⇒ Object
140 141 142 |
# File 'lib/webpage-archivist/models.rb', line 140 def file_name "#{file_hash}#{extension}" end |
#validate ⇒ Object
135 136 137 138 |
# File 'lib/webpage-archivist/models.rb', line 135 def validate super validates_max_length 10, :extension end |