Sha256: e64e8940b26040ad8a3d41ec2a2dbaa84d19c885a6a4fba228d59af38da0831e

Contents?: true

Size: 617 Bytes

Versions: 4

Compression:

Stored size: 617 Bytes

Contents

# frozen_string_literal: true
require 'imgix'

module Dato
  module Local
    module FieldType
      class File
        attr_reader :path, :format, :size

        def self.parse(value, _repo)
          new(
            value[:path],
            value[:format],
            value[:size]
          )
        end

        def initialize(path, format, size)
          @path = path
          @format = format
          @size = size
        end

        def file
          Imgix::Client.new(
            host: 'dato-images.imgix.net',
            secure: true
          ).path(path)
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
dato-0.1.10 lib/dato/local/field_type/file.rb
dato-0.1.9 lib/dato/local/field_type/file.rb
dato-0.1.8 lib/dato/local/field_type/file.rb
dato-0.1.6 lib/dato/local/field_type/file.rb