Sha256: 96dca81b51429b5c881d51e082ba12e8eaba1729324f0693f4b0116224d39225
Contents?: true
Size: 869 Bytes
Versions: 49
Compression:
Stored size: 869 Bytes
Contents
module Pageflow class PositionedFile attr_reader :file, :position_x, :position_y delegate :thumbnail_url, to: :file def initialize(file, position_x = nil, position_y = nil) @file = file @position_x = position_x.presence || 50 @position_y = position_y.presence || 50 end def ==(other) super(other) || other == file || (other.is_a?(PositionedFile) && other.file == file) end def to_model file end def self.wrap(file, position_x, position_y) file ? new(file, position_x, position_y) : nil end def self.null Null.new end class Null < PositionedFile def initialize super(nil) end def thumbnail_url(*args) ImageFile.new.processed_attachment.url(*args) end def blank? true end end end end
Version data entries
49 entries across 49 versions & 1 rubygems