Peter Alvin wrote:
> In irb I did:
> 
> puts 1 & 1
> and get 1
> shouldn't I get true?
> 
> Bottom line is this: What is Ruby idiom to test for bit mask?  Is there
> a more simple way to write:
> 
> if session[:permissions] & Permissions::SomeMask ==
> Permissions::SomeMask
>   # user has permission to wash clothes, etc.
> end

a && b returns the first false element or the last true element.

a & b where a and b are Fixnums does a bit mask like you're looking for.

- Charlie