Module: Ladder::File

Extended by:
ActiveSupport::Concern
Includes:
ActiveTriples::Identifiable, 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.



25
26
27
# File 'lib/ladder/file.rb', line 25

def file
  @file
end

Instance Method Details

#dataObject

Output content of object from stored file or readable input



29
30
31
32
33
34
35
# File 'lib/ladder/file.rb', line 29

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_resourceObject

Return an empty ActiveTriples resource for serializing related resources



39
40
41
# File 'lib/ladder/file.rb', line 39

def update_resource
  resource
end