lib/image_mosaic/data/validator.rb in image_mosaic-0.1.2 vs lib/image_mosaic/data/validator.rb in image_mosaic-0.1.3

- old
+ new

@@ -4,18 +4,23 @@ def initialize(urls) @urls = urls end def items - @items ||= create_images.compact + @items ||= validate_items.compact end private - def create_images + def validate_items @urls.map do |url| - child = Image::Child.new(url) - child if child.valid? + image = Image::Child.new(url) + next unless image.valid? + { + url: url, + h: image.height, + w: image.width + } end end end end end