Module: Apiphobic::Tokens::RolePredicable

Included in:
JsonWebToken, JsonWebTokens::Null
Defined in:
lib/apiphobic/tokens/role_predicable.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/apiphobic/tokens/role_predicable.rb', line 6

def method_missing(name, *args)
  if role_predicates.include?(name)
    roles.map(&:to_s).include?(name.to_s.gsub(/\?\z/, ''))
  else
    super
  end
end

Instance Method Details

#respond_to_missing?(name, include_all) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/apiphobic/tokens/role_predicable.rb', line 14

def respond_to_missing?(name, include_all)
  role_predicates.include?(name) || super
end