Class | Dragonfly::Content |
In: |
lib/dragonfly/content.rb
|
Parent: | Object |
A Dragonfly::Content object is responsible for holding
Furthermore, it belongs to a Dragonfly app, so has access to its already registered generators, processors, analysers and datastore. It provides convenience methods for updating its content, and though the original data may have been in the form of a String, or a Pathname, etc. methods like "path", "data" and "file" will always work regardless.
It is acted upon in generator, processor, analyser and datastore methods and provides a standard interface for updating content, no matter how that content first got there (whether in the form of a String/Pathname/File/etc.)
app | [R] | |
meta | [RW] | @return [Hash] |
previous_temp_objects | [R] | |
temp_object | [R] |
Add to the meta (merge) @param meta [Hash] - should be json-like, i.e. contain no types other than String, Number, Boolean
@example
"data:image/jpeg;base64,IGSsdhfsoi..."
@return [String] A data url representation of the data
Set the content using a pre-registered generator @example
content.generate!(:text, "some text")
@return [Content] self
The mime-type taken from the name‘s file extension @example "image/jpeg" @return [String]
Update the content using a pre-registered processor @example
content.process!(:convert, "-resize 300x300")
@return [Content] self
Analyse the content using a shell command @param opts [Hash] passing :escape => false doesn‘t shell-escape each word @example
content.shell_eval do |path| "file --mime-type #{path}" end # ===> "beach.jpg: image/jpeg"
Update the content @param obj [String, Pathname, Tempfile, File, Content, TempObject] can be any of these types @param meta [Hash] - should be json-like, i.e. contain no types other than String, Number, Boolean @return [Content] self