Skip to content

Instantly share code, notes, and snippets.

@lolgear
Last active August 29, 2015 14:04
Show Gist options
  • Save lolgear/63f5d21cbd998188dd36 to your computer and use it in GitHub Desktop.
Save lolgear/63f5d21cbd998188dd36 to your computer and use it in GitHub Desktop.
self.images =
images
.select{
|image|
image.kind_of?(ImageClass)
}
.map{
|image|
self.generate_image_object_from_image
}
@jhass
Copy link

jhass commented Aug 6, 2014

That I'd write as

self.images = images.select {|image| image.is_a?(ImageClass) }
                    .map {|image| generate_image_object_from image }

or if the block bodies are longer/multiline

self.images = images.select {|image|
  image.is_a?(ImageClass)
}.map {|image|
  generate_image_object_from image
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment