Class: SlackRubyBot::Commands::Help::Attrs

Inherits:
Object
  • Object
show all
Defined in:
lib/slack-ruby-bot/commands/help/attrs.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_nameObject (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_descObject

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_descObject

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_nameObject

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

#commandsObject (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