Sha256: 1d857940064a63773db015a96631a8a79918e26a38c6d816820d4f280b507414
Contents?: true
Size: 1.5 KB
Versions: 26
Compression:
Stored size: 1.5 KB
Contents
module Attached module Storage class Base # Helper for parsing credentials from a hash, file, or string. # # Usage: # # parse({...}) # parse(File.open(...)) # Parse("...") def parse(credentials) case credentials when Hash then credentials when File then YAML::load(credentials)[Rails.env] when String then YAML::load(File.read(credentials))[Rails.env] else raise ArgumentError.new("credentials must be a hash, file, or string") end end # Create a new file system storage interface supporting save and destroy operations. # # Usage: # # Base.new() def initialize(credentials = nil) raise NotImplementedError.new end # Access the host for a storage service or return null if local. # # Usage: # # storage.host def host() raise NotImplementedError.new end # Save a file to a given path (abstract). # # Parameters: # # * file - The file to save. # * path - The path to save. def save(file, path) raise NotImplementedError.new end # Destroy a file at a given path (abstract). # # Parameters: # # * path - The path to destroy. def destroy(path) raise NotImplementedError.new end end end end
Version data entries
26 entries across 26 versions & 1 rubygems