class Prpr::Action::MentionComment::Mention
Constants
- REGEXP
Public Instance Methods
call()
click to toggle source
# File lib/prpr/action/mention_comment/mention.rb, line 7 def call if mention? Publisher::Adapter::Base.broadcast message end end
Private Instance Methods
body()
click to toggle source
# File lib/prpr/action/mention_comment/mention.rb, line 23 def body <<-END #{comment_body} #{comment.html_url} END end
comment()
click to toggle source
# File lib/prpr/action/mention_comment/mention.rb, line 37 def comment event.comment end
comment_body()
click to toggle source
# File lib/prpr/action/mention_comment/mention.rb, line 31 def comment_body comment.body.gsub(REGEXP) { |old| members[old] || old } end
config()
click to toggle source
# File lib/prpr/action/mention_comment/mention.rb, line 59 def config @config ||= Config::Github.new(repository_name) end
env()
click to toggle source
# File lib/prpr/action/mention_comment/mention.rb, line 63 def env Config::Env.default end
from()
click to toggle source
# File lib/prpr/action/mention_comment/mention.rb, line 41 def from event.sender end
members()
click to toggle source
# File lib/prpr/action/mention_comment/mention.rb, line 49 def members @members ||= config.read(name).lines.map { |line| if line =~ / \* (\S+):\s*(\S+)/ [$1, $2] end }.to_h rescue @members ||= {} end
mention?()
click to toggle source
# File lib/prpr/action/mention_comment/mention.rb, line 19 def mention? comment.body =~ REGEXP end
message()
click to toggle source
# File lib/prpr/action/mention_comment/mention.rb, line 15 def message Prpr::Publisher::Message.new(body: body, from: from, room: room) end
name()
click to toggle source
# File lib/prpr/action/mention_comment/mention.rb, line 67 def name env[:mention_comment_members] || 'MEMBERS.md' end
repository_name()
click to toggle source
# File lib/prpr/action/mention_comment/mention.rb, line 71 def repository_name event.repository.full_name end
room()
click to toggle source
# File lib/prpr/action/mention_comment/mention.rb, line 45 def room env[:mention_comment_room] end