Class: Travis::Stalker::Charlie
- Inherits:
-
Object
- Object
- Travis::Stalker::Charlie
- Defined in:
- lib/travis/stalker/charlie.rb
Instance Attribute Summary collapse
-
#projects ⇒ Object
Returns the value of attribute projects.
Instance Method Summary collapse
-
#initialize(pusher_token, projects = [], regex = false) ⇒ Charlie
constructor
Initialize a new connection to travis feed.
- #regex? ⇒ Boolean
- #start ⇒ Object
Constructor Details
#initialize(pusher_token, projects = [], regex = false) ⇒ Charlie
Initialize a new connection to travis feed
publisher_token - pusher token id projects - Array of projects to stalk regex - if true then accept partial matches
18 19 20 21 22 23 24 |
# File 'lib/travis/stalker/charlie.rb', line 18 def initialize(pusher_token, projects=[], regex=false) @projects = projects @regex = regex @socket = PusherClient::Socket.new(pusher_token) Travis::Stalker.log(regex: regex, projects: projects) end |
Instance Attribute Details
#projects ⇒ Object
Returns the value of attribute projects.
10 11 12 |
# File 'lib/travis/stalker/charlie.rb', line 10 def projects @projects end |
Instance Method Details
#regex? ⇒ Boolean
26 27 28 |
# File 'lib/travis/stalker/charlie.rb', line 26 def regex? @regex end |
#start ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/travis/stalker/charlie.rb', line 30 def start @socket.subscribe('common') @socket['common'].bind('build:finished') do |payload| notify(payload_to_notification(JSON.parse(payload))) end @socket.connect end |