Sha256: d04ba96a558dbba2cdab4b2d255229be5db8fe6542c93eff2f742bc2699be726
Contents?: true
Size: 1.25 KB
Versions: 3
Compression:
Stored size: 1.25 KB
Contents
module RailsConnector module ObjBody # Returns the body (main content) of the Obj for non-binary Objs. # Returns nil for binary Objs. def body if binary? nil else StringTagging.tag_as_html(read_attribute(:blob), self) end end # for binary Objs body_length equals the file size # for non-binary Objs body_length equals the number of characters in the body (main content) def body_length if binary? blob = find_blob blob ? blob.length : 0 else (body || "").length end end # returns an URL to retrieve the Obj's body for binary Objs. # returns nil for non-binary Objs. def body_data_url if binary? blob = find_blob blob.url if blob end end def body_data_path # :nodoc: # not needed/supported when using cloud connector. nil end # returns the content type of the Obj's body for binary Objs. # returns nil for non-binary Objs. def body_content_type if binary? blob = find_blob if blob blob.content_type else "application/octet-stream" end end end private def find_blob blob_spec = read_attribute(:blob) Blob.find(blob_spec["id"], :context => path) if blob_spec end end end # module RailsConnector
Version data entries
3 entries across 3 versions & 1 rubygems