Sha256: 871d77371e7437de1dc400a7840313e1b56a8c479de5601f489e4314a1bd6330

Contents?: true

Size: 773 Bytes

Versions: 3

Compression:

Stored size: 773 Bytes

Contents

# encoding: utf-8
module LightResizer
  class ImageLoader
    class OriginalImage

      attr_accessor :relative_path

      def initialize(root_dir)
        @root_dir = root_dir
      end

      # Full original image path /{root}/some_dir/image.png
      def full_path
        File.join(@root_dir, relative_path)
      end

      # Absolute store /{root}/some_dir
      def dir_path
        File.dirname( full_path ).to_s
      end

      # Requested filename /image.png
      def filename
        File.basename( full_path ).to_s
      end

      # Relative file store dir /some_dir/
      def relative_dir
        dir_path.gsub(@root_dir, '')
      end

      # {Bool} original image exist
      def image_exist?
        File.exist? full_path
      end

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
light_resizer-0.1.2 lib/light_resizer/image_loader/original_image.rb
light_resizer-0.1.1 lib/light_resizer/image_loader/original_image.rb
light_resizer-0.0.2 lib/light_resizer/image_loader/original_image.rb