Sha256: 45114202c44b90d47880eecea10a4827a0fb6cc6193dc6c967fa2db449a15e5a
Contents?: true
Size: 566 Bytes
Versions: 2
Compression:
Stored size: 566 Bytes
Contents
# frozen_string_literal: true require "fastimage" require "open-uri" class Scarpe class Image < Scarpe::Widget display_properties :url, :width, :height, :top, :left, :click def initialize(url, width: nil, height: nil, top: nil, left: nil, click: nil) @url = url super # Get the image dimensions # @width, @height = size create_display_widget end def replace(url) self.url = url end end class Widget def size width, height = FastImage.size(@url) [width, height] end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
scarpe-0.2.1 | lib/scarpe/image.rb |
scarpe-0.2.0 | lib/scarpe/image.rb |