Sha256: 2245ffbba8a8457a4888d989df09086363a231ba3da50bb98a03140511aba633
Contents?: true
Size: 929 Bytes
Versions: 3
Compression:
Stored size: 929 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(host = default_host) Imgix::Client.new( host: host, secure: true ).path(path) end def url(host: default_host, **opts) file(host).to_url(opts) end def to_hash { format: format, size: size, url: url } end private def default_host 'dato-images.imgix.net' end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
dato-0.2.7 | lib/dato/local/field_type/file.rb |
dato-0.2.6 | lib/dato/local/field_type/file.rb |
dato-0.2.4 | lib/dato/local/field_type/file.rb |