Class: Commandorobo::NoPermission

Inherits:
Object
  • Object
show all
Defined in:
lib/commandorobo.rb

Overview

Class that gets returned by Command#perm_check whenever the user does not have permission.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(perm) ⇒ NoPermission

Returns a new instance of NoPermission.



18
19
20
# File 'lib/commandorobo.rb', line 18

def initialize(perm)
    @perm = perm
end

Instance Attribute Details

#permArray (readonly)

The permissions returned as an array of symbols.

Returns:

  • (Array)

    the current value of perm



16
17
18
# File 'lib/commandorobo.rb', line 16

def perm
  @perm
end

Instance Method Details

#prettifyArray

Generates a “pretty” array of strings for permissions.

Returns:

  • (Array)

    An array of strings representing the pretty name for permissions.



24
25
26
27
28
# File 'lib/commandorobo.rb', line 24

def prettify
    @perm.map do |t| # <hackiness>

        t.to_s.split(/_/).map(&:capitalize).join(' ')
    end # </hackiness>

end