class Saviour::ReadOnlyFile

Attributes

persisted_path[R]
storage[R]

Public Class Methods

new(persisted_path, storage) click to toggle source
# File lib/saviour/read_only_file.rb, line 5
def initialize(persisted_path, storage)
  @persisted_path = persisted_path
  @storage = storage
end

Public Instance Methods

==(another_file) click to toggle source
# File lib/saviour/read_only_file.rb, line 25
def ==(another_file)
  return false unless another_file.is_a?(Saviour::File) || another_file.is_a?(ReadOnlyFile)
  return false unless another_file.persisted?

  another_file.persisted_path == persisted_path
end
exists?() click to toggle source
# File lib/saviour/read_only_file.rb, line 10
def exists?
  persisted? && @storage.exists?(@persisted_path)
end
persisted?() click to toggle source
# File lib/saviour/read_only_file.rb, line 32
def persisted?
  true
end
public_url() click to toggle source
# File lib/saviour/read_only_file.rb, line 19
def public_url
  return nil unless persisted?
  @storage.public_url(@persisted_path)
end
Also aliased as: url
read() click to toggle source
# File lib/saviour/read_only_file.rb, line 14
def read
  return nil unless persisted?
  @storage.read(@persisted_path)
end
url()
Alias for: public_url