OK but I thought the result of x.tap is always x, not the result of what
tap does


On Wed, Jun 5, 2013 at 10:58 AM, Rafał Rzepecki <notifications@github.com>wrote:

> In lib/conjur/command/roles.rb:
>
> > @@ -30,24 +30,17 @@ class Conjur::Command::Roles < Conjur::Command
> >    arg_name "role"
> >    command :memberships do |c|
> >      c.action do |global_options,options,args|
> > -      role = args.shift || api.user(api.username).roleid
> > -      display api.role(role).all.map(&:roleid)
> > +      role = args.shift.tap {|r| r && api.role(r)} || api.current_role
>
> This is to avoid less concise, full blown if else. Probably would have
> been clearer with '!r.nil? &&' instead.
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/inscitiv/cli-ruby/pull/3/files#r4546992>
> .
>