Sha256: 7bb9e7bf3e25fae65027f5bf232a1e7fe8d268d42b628139394998f6901fb1a7
Contents?: true
Size: 950 Bytes
Versions: 2
Compression:
Stored size: 950 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
dato-0.1.31 | lib/dato/local/field_type/file.rb |
dato-0.1.30 | lib/dato/local/field_type/file.rb |