Sha256: beea0f0ecc2fcbfcc5f85628dcca5f652ff54dc013b7e125bddc3767b8bb5e98
Contents?: true
Size: 1.25 KB
Versions: 4
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(:body), 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
4 entries across 4 versions & 1 rubygems