Sha256: 9382402dabbe547954ecd5498ed473601b219eafeacf2371164708a43aa148bd

Contents?: true

Size: 585 Bytes

Versions: 4

Compression:

Stored size: 585 Bytes

Contents

require 'English'

module S3Repo
  ##
  # Base object, used to provide common attributes
  class Base
    def initialize(params = {})
      @options = params
    end

    private

    def run(cmd)
      results = `#{cmd} 2>&1`
      return results if $CHILD_STATUS.success?
      raise "Failed running #{cmd}:\n#{results}"
    end

    def bucket
      @options[:bucket] || raise('No bucket given')
    end

    def client
      @options[:client] ||= Client.new(@options)
    end

    def file_cache
      @file_cache ||= @options[:file_cache] || Cache.new(@options)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
s3repo-2.0.3 lib/s3repo/base.rb
s3repo-2.0.2 lib/s3repo/base.rb
s3repo-2.0.1 lib/s3repo/base.rb
s3repo-2.0.0 lib/s3repo/base.rb