Class: SlackRubyBot::Commands::Support::Attrs
- Inherits:
-
Object
- Object
- SlackRubyBot::Commands::Support::Attrs
- Defined in:
- lib/slack-ruby-bot/commands/support/attrs.rb
Instance Attribute Summary collapse
-
#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.
-
#klass ⇒ Object
readonly
Returns the value of attribute klass.
Instance Method Summary collapse
- #command(title, &block) ⇒ Object
- #desc(desc) ⇒ Object
-
#initialize(klass) ⇒ Attrs
constructor
A new instance of Attrs.
- #long_desc(long_desc) ⇒ Object
- #title(title) ⇒ Object
Constructor Details
#initialize(klass) ⇒ Attrs
Returns a new instance of Attrs.
10 11 12 13 |
# File 'lib/slack-ruby-bot/commands/support/attrs.rb', line 10 def initialize(klass) @klass = klass @commands = [] end |
Instance Attribute Details
#command_desc ⇒ Object
Returns the value of attribute command_desc.
7 8 9 |
# File 'lib/slack-ruby-bot/commands/support/attrs.rb', line 7 def command_desc @command_desc end |
#command_long_desc ⇒ Object
Returns the value of attribute command_long_desc.
7 8 9 |
# File 'lib/slack-ruby-bot/commands/support/attrs.rb', line 7 def command_long_desc @command_long_desc end |
#command_name ⇒ Object
Returns the value of attribute command_name.
7 8 9 |
# File 'lib/slack-ruby-bot/commands/support/attrs.rb', line 7 def command_name @command_name end |
#commands ⇒ Object (readonly)
Returns the value of attribute commands.
8 9 10 |
# File 'lib/slack-ruby-bot/commands/support/attrs.rb', line 8 def commands @commands end |
#klass ⇒ Object (readonly)
Returns the value of attribute klass.
8 9 10 |
# File 'lib/slack-ruby-bot/commands/support/attrs.rb', line 8 def klass @klass end |
Instance Method Details
#command(title, &block) ⇒ Object
27 28 29 30 31 32 |
# File 'lib/slack-ruby-bot/commands/support/attrs.rb', line 27 def command(title, &block) @commands << self.class.new(klass).tap do |k| k.title(title) k.instance_eval(&block) end end |
#desc(desc) ⇒ Object
19 20 21 |
# File 'lib/slack-ruby-bot/commands/support/attrs.rb', line 19 def desc(desc) self.command_desc = desc end |
#long_desc(long_desc) ⇒ Object
23 24 25 |
# File 'lib/slack-ruby-bot/commands/support/attrs.rb', line 23 def long_desc(long_desc) self.command_long_desc = long_desc end |
#title(title) ⇒ Object
15 16 17 |
# File 'lib/slack-ruby-bot/commands/support/attrs.rb', line 15 def title(title) self.command_name = title end |