Class: SlackRubyBot::Commands::Help::Attrs
- Inherits:
-
Object
- Object
- SlackRubyBot::Commands::Help::Attrs
- Defined in:
- lib/slack-ruby-bot/commands/help/attrs.rb
Instance Attribute Summary collapse
-
#class_name ⇒ Object
readonly
Returns the value of attribute class_name.
-
#command_desc ⇒ Object
Returns the value of attribute command_desc.
-
#command_long_desc ⇒ Object
Returns the value of attribute command_long_desc.
-
#command_name ⇒ Object
Returns the value of attribute command_name.
-
#commands ⇒ Object
readonly
Returns the value of attribute commands.
Instance Method Summary collapse
- #command(title, &block) ⇒ Object
- #desc(desc) ⇒ Object
-
#initialize(class_name) ⇒ Attrs
constructor
A new instance of Attrs.
- #long_desc(long_desc) ⇒ Object
- #title(title) ⇒ Object
Constructor Details
#initialize(class_name) ⇒ Attrs
Returns a new instance of Attrs.
8 9 10 11 |
# File 'lib/slack-ruby-bot/commands/help/attrs.rb', line 8 def initialize(class_name) @class_name = class_name @commands = [] end |
Instance Attribute Details
#class_name ⇒ Object (readonly)
Returns the value of attribute class_name.
6 7 8 |
# File 'lib/slack-ruby-bot/commands/help/attrs.rb', line 6 def class_name @class_name end |
#command_desc ⇒ Object
Returns the value of attribute command_desc.
5 6 7 |
# File 'lib/slack-ruby-bot/commands/help/attrs.rb', line 5 def command_desc @command_desc end |
#command_long_desc ⇒ Object
Returns the value of attribute command_long_desc.
5 6 7 |
# File 'lib/slack-ruby-bot/commands/help/attrs.rb', line 5 def command_long_desc @command_long_desc end |
#command_name ⇒ Object
Returns the value of attribute command_name.
5 6 7 |
# File 'lib/slack-ruby-bot/commands/help/attrs.rb', line 5 def command_name @command_name end |
#commands ⇒ Object (readonly)
Returns the value of attribute commands.
6 7 8 |
# File 'lib/slack-ruby-bot/commands/help/attrs.rb', line 6 def commands @commands end |
Instance Method Details
#command(title, &block) ⇒ Object
25 26 27 28 29 30 |
# File 'lib/slack-ruby-bot/commands/help/attrs.rb', line 25 def command(title, &block) @commands << self.class.new(class_name).tap do |k| k.title(title) k.instance_eval(&block) end end |
#desc(desc) ⇒ Object
17 18 19 |
# File 'lib/slack-ruby-bot/commands/help/attrs.rb', line 17 def desc(desc) self.command_desc = desc end |
#long_desc(long_desc) ⇒ Object
21 22 23 |
# File 'lib/slack-ruby-bot/commands/help/attrs.rb', line 21 def long_desc(long_desc) self.command_long_desc = long_desc end |
#title(title) ⇒ Object
13 14 15 |
# File 'lib/slack-ruby-bot/commands/help/attrs.rb', line 13 def title(title) self.command_name = title end |