Class: Formol::Permissions::Profile

Inherits:
Object
  • Object
show all
Defined in:
lib/formol/permissions/profile.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, rights = []) ⇒ Profile

Returns a new instance of Profile.



6
7
8
9
# File 'lib/formol/permissions/profile.rb', line 6

def initialize(name, rights = [])
  @name   = name.to_sym
  @rights = rights.collect(&:to_sym)
end

Instance Attribute Details

#rightsObject (readonly)

Returns the value of attribute rights.



4
5
6
# File 'lib/formol/permissions/profile.rb', line 4

def rights
  @rights
end

Instance Method Details

#<<(right) ⇒ Object



15
16
17
# File 'lib/formol/permissions/profile.rb', line 15

def <<(right)
  @rights << right.to_sym
end

#delete(right) ⇒ Object



19
20
21
# File 'lib/formol/permissions/profile.rb', line 19

def delete(right)
  @rights.delete(right.to_sym)
end

#has_right?(right) ⇒ Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/formol/permissions/profile.rb', line 11

def has_right?(right)
  @rights.include?(right.to_sym)
end