Array.wrap - love it!
On Mar 23, 2013 11:37 PM, "Tute Costa" <notifications@github.com> wrote:

> In lib/merit/target_finder.rb:
>
> > +    def self.find(*args)
> > +      self.new(*args).find
> > +    end
> > +
> > +    def initialize(rule, action)
> > +      @rule = rule
> > +      @action = action
> > +    end
> > +
> > +    def find
> > +      target = case @rule.to
> > +               when :itself; base_target
> > +               when :action_user; action_user
> > +               else; other_target
> > +               end
> > +      if target.nil?
>
> Check Array#wrap:
>
> irb(main):001:0> Array.wrap(3)=> [3]irb(main):002:0> Array.wrap([3])=> [3]irb(main):003:0> Array.wrap(nil)=> []
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/tute/merit/pull/68/files#r3501421>
> .
>