Sha256: 3e25fcfc3a304b67edaf4d2c93a3899923e775ae951fe6f6218f413fe3c39fe7

Contents?: true

Size: 722 Bytes

Versions: 4

Compression:

Stored size: 722 Bytes

Contents

module SlackRubyBot
  module Commands
    module Support
      class Attrs
        attr_accessor :command_name, :command_desc, :command_long_desc
        attr_reader :klass, :commands

        def initialize(klass)
          @klass = klass
          @commands = []
        end

        def title(title)
          self.command_name = title
        end

        def desc(desc)
          self.command_desc = desc
        end

        def long_desc(long_desc)
          self.command_long_desc = long_desc
        end

        def command(title, &block)
          @commands << self.class.new(klass).tap do |k|
            k.title(title)
            k.instance_eval(&block)
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
slack-ruby-bot-0.12.0 lib/slack-ruby-bot/commands/support/attrs.rb
slack-ruby-bot-0.11.2 lib/slack-ruby-bot/commands/support/attrs.rb
slack-ruby-bot-0.11.1 lib/slack-ruby-bot/commands/support/attrs.rb
slack-ruby-bot-0.11.0 lib/slack-ruby-bot/commands/support/attrs.rb