Class: ActionGuard::Role

Inherits:
Object
  • Object
show all
Defined in:
lib/action-guard/role.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value, level) ⇒ Role

Returns a new instance of Role.



4
5
6
7
# File 'lib/action-guard/role.rb', line 4

def initialize(value, level)
  @value = value
  @level = level
end

Instance Attribute Details

#levelObject (readonly)

Returns the value of attribute level.



3
4
5
# File 'lib/action-guard/role.rb', line 3

def level
  @level
end

Instance Method Details

#<(other) ⇒ Object



13
14
15
# File 'lib/action-guard/role.rb', line 13

def < (other)
  level > other.level
end

#>=(other) ⇒ Object



9
10
11
# File 'lib/action-guard/role.rb', line 9

def >=(other)
  level <= other.level
end

#to_sObject



17
18
19
# File 'lib/action-guard/role.rb', line 17

def to_s
  "Role(:#{@value})"
end