Module: Ladder::File

Extended by:
ActiveSupport::Concern
Includes:
ActiveTriples::Identifiable, Configurable, Mongoid::Document
Defined in:
lib/ladder/file.rb

Defined Under Namespace

Modules: ClassMethods

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#fileObject

Returns the value of attribute file.



35
36
37
# File 'lib/ladder/file.rb', line 35

def file
  @file
end

Instance Method Details

#dataString

Output content of object from stored file or readable input

Returns:

  • (String)

    string-encoded copy of binary data



41
42
43
44
45
46
47
# File 'lib/ladder/file.rb', line 41

def data
  @grid_file ||= self.class.grid.get(id) if persisted?
  return @grid_file.data if @grid_file

  file.rewind if file.respond_to? :rewind
  file.read
end

#update_resourceActiveTriples::Resource

Return an empty ActiveTriples resource for serializing related resources

Returns:

  • (ActiveTriples::Resource)

    resource for the object



53
54
55
# File 'lib/ladder/file.rb', line 53

def update_resource
  resource
end