Class: WCC::Auth::AccessLevel
- Inherits:
-
Struct
- Object
- Struct
- WCC::Auth::AccessLevel
- Includes:
- Comparable
- Defined in:
- lib/wcc/auth/access_level.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
Returns the value of attribute description.
-
#id ⇒ Object
Returns the value of attribute id.
-
#level ⇒ Object
Returns the value of attribute level.
-
#name ⇒ Object
Returns the value of attribute name.
-
#slug ⇒ Object
Returns the value of attribute slug.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description
12 13 14 |
# File 'lib/wcc/auth/access_level.rb', line 12 def description @description end |
#id ⇒ Object
Returns the value of attribute id
12 13 14 |
# File 'lib/wcc/auth/access_level.rb', line 12 def id @id end |
#level ⇒ Object
Returns the value of attribute level
12 13 14 |
# File 'lib/wcc/auth/access_level.rb', line 12 def level @level end |
#name ⇒ Object
Returns the value of attribute name
12 13 14 |
# File 'lib/wcc/auth/access_level.rb', line 12 def name @name end |
#slug ⇒ Object
Returns the value of attribute slug
12 13 14 |
# File 'lib/wcc/auth/access_level.rb', line 12 def slug @slug end |
Class Method Details
.[](index_or_slug, db = ACCESS_LEVELS) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/wcc/auth/access_level.rb', line 19 def self.[](index_or_slug, db=ACCESS_LEVELS) all(db).find do |al| al.level.to_s === index_or_slug.to_s || al.slug === index_or_slug.to_s end end |
.all(db = ACCESS_LEVELS) ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'lib/wcc/auth/access_level.rb', line 26 def self.all(db=ACCESS_LEVELS) db.collect do |row| new.tap { |access_level| row.each { |field, value| access_level[field] = value } } end.sort end |
Instance Method Details
#<=>(record) ⇒ Object
15 16 17 |
# File 'lib/wcc/auth/access_level.rb', line 15 def <=>(record) self.level <=> record.level end |