Sha256: 2f0ef9500e8914b2a1212f901630d35b6fcd672a324d3380c39b5546327eb0b4
Contents?: true
Size: 968 Bytes
Versions: 3
Compression:
Stored size: 968 Bytes
Contents
require 'fiona7/builder/container_chain_builder' module Fiona7 module Builder class IndirectBlobBuilder def initialize(parent_path, filename, file=nil) @parent_path = parent_path @filename = filename @file = file end def call parent = ContainerChainBuilder.new(@parent_path).call ext = ::File.extname(@filename).to_s[1..-1].to_s.downcase name = ::File.basename(@filename, '.' + ext) obj_class = if ['jpg', 'jpeg', 'gif', 'png', 'tif', 'tiff'].include?(ext) 'X_Image' else 'X_Generic' end if @file upload = WriteObj.upload(@file, ext, {name: name, parent: parent, obj_class: obj_class}).tap(&:release!) else upload = WriteObj.create({name: name, parent: parent, obj_class: obj_class}).tap(&:release!) end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems