Sha256: 397653b2e0f46273185c74c6f307e32e3830162851a9ede61fd3226443318a8b

Contents?: true

Size: 717 Bytes

Versions: 1

Compression:

Stored size: 717 Bytes

Contents

module Artaius
  module Plugins
    # Provides useful links to KAG resources and maybe some other related
    # information.
    class Informator
      include Cinch::Plugin

      set react_on: :channel

      methods = [:site, :wiki, :forum, :manual, :blog, :download, :bug_tracker]

      methods.each do |method|
        pattern = I18n.informator.m.send(method)
        instance_eval <<-EVAL
          match /#{pattern}$/,
                method:     :#{method},
                use_suffix:  false
        EVAL
      end

      methods.each do |method|
        class_eval <<-EVAL
          def #{method}(m)
            m.reply I18n.informator.kag_#{method}
          end
        EVAL
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
artaius-0.2.1 lib/artaius/plugins/informator.rb