Sha256: 780e1016120ddb64087cde9a4bf0503140d60c6ea7769ce881cb52d75e1461ea
Contents?: true
Size: 859 Bytes
Versions: 15
Compression:
Stored size: 859 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.attachment.url(*args) end def blank? true end end end end
Version data entries
15 entries across 15 versions & 1 rubygems