Sha256: 5b7b957414eff38278712b659c4b3c90b3ea9fa6110d21728780b7fc17274d27
Contents?: true
Size: 1.06 KB
Versions: 2
Compression:
Stored size: 1.06 KB
Contents
module Hipbot class Reaction < Struct.new(:plugin, :options, :block) def any_room? options[:room] == true end def anything? regexps.blank? end def anywhere? options[:room].nil? end def desc options[:desc] end def from_all? options[:from].blank? end def global? !!options[:global] end def inspect "#<Hipbot::Reaction #{options}>" end def plugin_name plugin.name.demodulize end def match_with message Match.new(self, message) end def private_message_only? options[:room] == false end def readable_command regexps.to_s.gsub(/(?<!\\)(\/|\[|\]|\^|\\z|\$|\\)/, '') end def regexps options[:regexps] end def rooms replace_symbols options[:room], Hipbot.rooms end def users replace_symbols options[:from], Hipbot.teams end protected def replace_symbols values, replacements_hash Array(values).flat_map{ |v| replacements_hash[v].presence || v.to_s } end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
hipbot-1.0.0.rc2 | lib/hipbot/reaction.rb |
hipbot-1.0.0.rc1 | lib/hipbot/reaction.rb |