class ChatWorkToSlack::Message
Attributes
channel[R]
users[R]
Public Class Methods
new(args)
click to toggle source
# File lib/chatwork_to_slack/message.rb, line 11 def initialize(args) chatwork_message = args[:message] @time = chatwork_message[0] @name = chatwork_message[1] @text = chatwork_message[2] @users = args[:users] @channel = args[:channel] @chatwork_users = args[:chatwork_users] end
Public Instance Methods
filters()
click to toggle source
# File lib/chatwork_to_slack/message.rb, line 44 def filters [ ChatWorkToSlack::Filters::Dtext, ChatWorkToSlack::Filters::Emoji, ChatWorkToSlack::Filters::Picon, ChatWorkToSlack::Filters::Pre, ChatWorkToSlack::Filters::Reply, ChatWorkToSlack::Filters::Quote, ] end
name()
click to toggle source
# File lib/chatwork_to_slack/message.rb, line 25 def name if @name.match(/\A[\d]+\Z/) user = @users.find{|u| u[:chatwork_account_id] == @name.to_i} else user = @users.find{|u| u[:chatwork_name] == @name} end if !!user user[:slack_name] || @name else @name end end
text()
click to toggle source
# File lib/chatwork_to_slack/message.rb, line 39 def text options = { users: users } filters.inject(@text) {|text, filter| filter.call(text, options)} end
time()
click to toggle source
# File lib/chatwork_to_slack/message.rb, line 21 def time Time.parse(@time).to_i end
to_slack()
click to toggle source
# File lib/chatwork_to_slack/message.rb, line 55 def to_slack [time, channel, name, text] end