Class: Models::Authorized::HandyRoles

Inherits:
Array
  • Object
show all
Defined in:
lib/kit/models/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 (protected)



179
180
181
182
183
184
# File 'lib/kit/models/authorized.rb', line 179

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)


173
174
175
# File 'lib/kit/models/authorized.rb', line 173

def include? role
  super role.to_s
end