Class: MongoMapper::Plugins::Authorized::InstanceMethods::HandyRoles

Inherits:
Array
  • Object
show all
Defined in:
lib/rad/mongo_mapper/acts_as/authorized.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, *args, &block) ⇒ Object



177
178
179
180
181
182
# File 'lib/rad/mongo_mapper/acts_as/authorized.rb', line 177

def method_missing m, *args, &block
  m = m.to_s
  super unless m.last == '?'

  self.include? m[0..-2]
end

Instance Method Details

#include?(role) ⇒ Boolean Also known as: has?

Returns:

  • (Boolean)


172
173
174
# File 'lib/rad/mongo_mapper/acts_as/authorized.rb', line 172

def include? role
  super role.to_s
end