Class: TinyIRC::Permission
- Inherits:
-
Object
- Object
- TinyIRC::Permission
- Defined in:
- lib/tinyirc/perms.rb
Instance Attribute Summary collapse
-
#branch ⇒ Object
readonly
Returns the value of attribute branch.
-
#command ⇒ Object
readonly
Returns the value of attribute command.
-
#plugin ⇒ Object
readonly
Returns the value of attribute plugin.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(plugin, command, branch) ⇒ Permission
constructor
A new instance of Permission.
- #to_s ⇒ Object
Constructor Details
#initialize(plugin, command, branch) ⇒ Permission
Returns a new instance of Permission.
10 11 12 13 14 |
# File 'lib/tinyirc/perms.rb', line 10 def initialize(plugin, command, branch) @plugin = plugin @command = command @branch = branch end |
Instance Attribute Details
#branch ⇒ Object (readonly)
Returns the value of attribute branch.
2 3 4 |
# File 'lib/tinyirc/perms.rb', line 2 def branch @branch end |
#command ⇒ Object (readonly)
Returns the value of attribute command.
2 3 4 |
# File 'lib/tinyirc/perms.rb', line 2 def command @command end |
#plugin ⇒ Object (readonly)
Returns the value of attribute plugin.
2 3 4 |
# File 'lib/tinyirc/perms.rb', line 2 def plugin @plugin end |
Class Method Details
.parse(pstr) ⇒ Object
4 5 6 7 8 |
# File 'lib/tinyirc/perms.rb', line 4 def self.parse(pstr) a = pstr.split('/', 3) raise RuntimeError, "Invalid permission: #{pstr}" unless a[0] || !a[1] && a[2] [a[0], a[1] || :all, a[2] || :all] end |
Instance Method Details
#==(other) ⇒ Object
16 17 18 |
# File 'lib/tinyirc/perms.rb', line 16 def ==(other) @plugin == other.plugin && @command == other.command && @branch == other.branch end |
#to_s ⇒ Object
20 21 22 |
# File 'lib/tinyirc/perms.rb', line 20 def to_s "#{@plugin}/#{@command}/#{@branch}" end |