git_stats/lib/git_stats/by_field_finder.rb

8 lines
194 B
Ruby
Raw Normal View History

2012-10-23 20:37:42 +02:00
# -*- encoding : utf-8 -*-
2012-10-19 16:39:39 +02:00
module ByFieldFinder
def method_missing(name, *args, &block)
field = name[/^by_(.*)$/, 1]
field ? find { |e| e.send(field) == args.first } : super
end
2012-10-23 20:37:42 +02:00
end