Sha256: 59ea0305ec776d9ab012ceb6e1c2dd140e72b413a9fac4a967c42a6af549a71b

Contents?: true

Size: 539 Bytes

Versions: 15

Compression:

Stored size: 539 Bytes

Contents

module Pansophy
  module Remote
    class ReadFileHead
      include Adamantium::Flat

      def initialize(bucket, path)
        @bucket   = bucket
        @pathname = Pathname.new(path)
      end

      def call
        fail ArgumentError, "#{@pathname} does not exist" if file.nil?
        file
      end

      private

      def file
        directory.files.head(@pathname.to_s)
      end
      memoize :file

      def directory
        ReadDirectory.new(@bucket, @pathname).call
      end
      memoize :directory
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
pansophy-1.3.0 lib/pansophy/remote/read_file_head.rb
pansophy-1.2.0 lib/pansophy/remote/read_file_head.rb
pansophy-1.1.0 lib/pansophy/remote/read_file_head.rb
pansophy-1.0.0 lib/pansophy/remote/read_file_head.rb
pansophy-1.0.0.pre.alpha.0 lib/pansophy/remote/read_file_head.rb
pansophy-0.6.0 lib/pansophy/remote/read_file_head.rb
pansophy-0.5.6 lib/pansophy/remote/read_file_head.rb
pansophy-0.5.5 lib/pansophy/remote/read_file_head.rb
pansophy-0.5.4 lib/pansophy/remote/read_file_head.rb
pansophy-0.5.3 lib/pansophy/remote/read_file_head.rb
pansophy-0.5.2 lib/pansophy/remote/read_file_head.rb
pansophy-0.5.1 lib/pansophy/remote/read_file_head.rb
pansophy-0.5.0 lib/pansophy/remote/read_file_head.rb
pansophy-0.4.0 lib/pansophy/remote/read_file_head.rb
pansophy-0.3.0 lib/pansophy/remote/read_file_head.rb