Skip to content

Commit

Permalink
Merge pull request martinrehfeld#15 from james2m/master
Browse files Browse the repository at this point in the history
update mask_for, fix rdoc deprecation and remove Gemfile.lock.
  • Loading branch information
Martin Rehfeld committed Mar 26, 2012
2 parents 565e919 + 9d766b0 commit 1624020
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 33 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -23,3 +23,4 @@ pkg


## PROJECT::SPECIFIC ## PROJECT::SPECIFIC
.rvmrc .rvmrc
Gemfile.lock
1 change: 1 addition & 0 deletions Gemfile
Expand Up @@ -3,5 +3,6 @@ source 'http://rubygems.org'
group :development do group :development do
gem 'jeweler', '>=1.5.2' gem 'jeweler', '>=1.5.2'
gem 'rspec', '~> 2' gem 'rspec', '~> 2'
gem 'rdoc', '>=2.4.2'
gem 'autotest' gem 'autotest'
end end
29 changes: 0 additions & 29 deletions Gemfile.lock

This file was deleted.

4 changes: 2 additions & 2 deletions Rakefile
Expand Up @@ -40,8 +40,8 @@ end


task :default => :spec task :default => :spec


require 'rake/rdoctask' require 'rdoc/task'
Rake::RDocTask.new do |rdoc| RDoc::Task.new do |rdoc|
version = File.exist?('VERSION') ? File.read('VERSION') : "" version = File.exist?('VERSION') ? File.read('VERSION') : ""


rdoc.rdoc_dir = 'rdoc' rdoc.rdoc_dir = 'rdoc'
Expand Down
5 changes: 3 additions & 2 deletions lib/role_model/class_methods.rb
Expand Up @@ -19,10 +19,11 @@ def roles_attribute=(name)
end end


def mask_for(*roles) def mask_for(*roles)
sanitized_roles = roles.map { |role| role.is_a?(Set) ? role.to_a : role }.flatten.map(&:to_sym) sanitized_roles = roles.map { |role| Array(role) }.flatten.map(&:to_sym)

(valid_roles & sanitized_roles).inject(0) { |sum, role| sum + 2**valid_roles.index(role) } (valid_roles & sanitized_roles).inject(0) { |sum, role| sum + 2**valid_roles.index(role) }
end end

protected protected


# :call-seq: # :call-seq:
Expand Down

0 comments on commit 1624020

Please sign in to comment.