Sha256: d0dc81df50cd5ff288c9745ce5ed81fa01434fde3ea79aaf6244ae2d4109cc3b

Contents?: true

Size: 753 Bytes

Versions: 7

Compression:

Stored size: 753 Bytes

Contents

# frozen_string_literal: true

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

7 entries across 7 versions & 2 rubygems

Version Path
slackrb-0.17.1 lib/slack-ruby-bot/commands/support/attrs.rb
slackrb-0.17.0 lib/slack-ruby-bot/commands/support/attrs.rb
slack-ruby-bot-0.16.1 lib/slack-ruby-bot/commands/support/attrs.rb
slack-ruby-bot-0.16.0 lib/slack-ruby-bot/commands/support/attrs.rb
slack-ruby-bot-0.15.0 lib/slack-ruby-bot/commands/support/attrs.rb
slack-ruby-bot-0.14.0 lib/slack-ruby-bot/commands/support/attrs.rb
slack-ruby-bot-0.13.0 lib/slack-ruby-bot/commands/support/attrs.rb