Method: Rolify::Role#method_missing

Defined in:
lib/rolify/role.rb

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



92
93
94
95
96
97
98
99
# File 'lib/rolify/role.rb', line 92

def method_missing(method, *args, &block)
  if method.to_s.match(/^is_(\w+)_of[?]$/) || method.to_s.match(/^is_(\w+)[?]$/)
    resource = args.first
    self.class.define_dynamic_method $1, resource
    return has_role?("#{$1}", resource)
  end unless !Rolify.dynamic_shortcuts
  super
end