Class: Mumukit::Auth::SingleGrant

Inherits:
Grant
  • Object
show all
Defined in:
lib/mumukit/auth/grant.rb

Instance Method Summary collapse

Methods inherited from Grant

#==, #as_json, parse, #to_mumukit_grant

Constructor Details

#initialize(slug) ⇒ SingleGrant

Returns a new instance of SingleGrant.



59
60
61
# File 'lib/mumukit/auth/grant.rb', line 59

def initialize(slug)
  @slug = slug
end

Instance Method Details

#allows?(resource_slug) ⇒ Boolean

Returns:

  • (Boolean)


63
64
65
66
# File 'lib/mumukit/auth/grant.rb', line 63

def allows?(resource_slug)
  resource_slug = resource_slug.to_mumukit_slug
  resource_slug.match_first(@slug.first) && resource_slug.match_second(@slug.second)
end

#to_sObject



68
69
70
# File 'lib/mumukit/auth/grant.rb', line 68

def to_s
  @slug.to_s
end