Class: SlackPoster
- Inherits:
-
Object
- Object
- SlackPoster
- Defined in:
- lib/slack_twitter_egosa/slack_poster.rb
Instance Method Summary collapse
-
#initialize(url) ⇒ SlackPoster
constructor
A new instance of SlackPoster.
- #post_status(status) ⇒ Object
Constructor Details
permalink #initialize(url) ⇒ SlackPoster
Returns a new instance of SlackPoster.
6 7 8 9 10 |
# File 'lib/slack_twitter_egosa/slack_poster.rb', line 6 def initialize(url) @poster = Slack::Poster.new(url) @locker = Mutex::new @pushed_ids = [] end |
Instance Method Details
permalink #post_status(status) ⇒ Object
[View source]
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/slack_twitter_egosa/slack_poster.rb', line 12 def post_status(status) @locker.synchronize do unless pushed?(status.id) @poster.icon_url = status.user.profile_image_url @poster.username = "#{status.user.name}(@#{status.user.screen_name})" @poster.("#{status.attrs[:full_text]}\n#{status.url}") push(status.id) end end end |