git_stats/lib/git_stats/by_field_finder.rb

8 lines
194 B
Ruby

# -*- encoding : utf-8 -*-
module ByFieldFinder
def method_missing(name, *args, &block)
field = name[/^by_(.*)$/, 1]
field ? find { |e| e.send(field) == args.first } : super
end
end