Skip to content
Browse files

only first

  • Loading branch information...
1 parent 553d783 commit 31e3b295654fe97a5f27afcf168ee26536eaa03d @joshbuddy joshbuddy committed Feb 25, 2012
Showing with 2 additions and 6 deletions.
  1. +2 −6 lib/jsonpath.rb
View
8 lib/jsonpath.rb
@@ -56,12 +56,8 @@ def on(obj_or_str)
enum_on(obj_or_str).to_a
end
- [:first, :last].each do |convenience_method|
- class_eval <<-EOT
- def #{convenience_method}(*args, &blk)
- enum_on(args.shift).#{convenience_method}(*args, &blk)
- end
- EOT
+ def first(obj_or_str, *args)
+ enum_on(obj_or_str).first(*args)
end
def enum_on(obj_or_str, mode = nil)

0 comments on commit 31e3b29

Please sign in to comment.
Something went wrong with that request. Please try again.