RubyFlow The Ruby and Rails community linklog

×

The Ruby and Rails community linklog

Made a library? Written a blog post? Found a useful tutorial? Share it with the Ruby community here or just enjoy what everyone else has found!

Submit a post

You can use basic HTML markup (e.g. <a>) or Markdown.
Note that your post may be edited to suit the format of the site.

As you are not logged in, you will be
directed via GitHub to signup or sign in

Post Preview

Note: Only the first pargraph is shown on the front page and overly long paragraphs may be broken up.

A gem for defining ruby exceptions

Exceptions in ruby are defined by subclassing off of a standard exception and then using raise to invoke them. Messaging is typically separate from the class definition which isn’t very DRY when invoking raise with a second String argument multiple times. The define_exception gem provides a succinct manner in which exceptions can be defined much like read/write attributes in your class using attr_accessor. It also makes it trivial to define a default message so that in most cases the second argument to raise is not necessary.

The problem I see with this is the lack of subclassing. Maybe a better approach…
If you look at the code under the hood you will see that this is a class method…
I understand, but you don’t always want a subclass of RuntimeError. Sometimes y…
Got it. I’ll add an optional argument which will allow for subclassing off ano…

Detecting duplicate images with Ruby

Phashion is a Ruby wrapper around the pHash library, an API for detecting duplicate and near-duplicate image, audio and video files. It currently only supports images but your help is welcome!

I use gem ‘phashion’, ‘~> 1.1’, ‘>= 1.1.1’ in Gemfile, firstly i am testi…
I use gem ‘phashion’, ‘~> 1.1’, ‘>= 1.1.1’ in Gemfile, firstly i am testi…
While user gem ‘phashion’, ‘~> 1.1’, ‘>= 1.1.1’ its give error RuntimeEr…
Loading older posts