class Fleek::Connection

Attributes

assets[R]

Public Class Methods

new(*args) click to toggle source
Calls superclass method
# File lib/fleek/connection.rb, line 10
def initialize(*args)
  super
  @assets = Concurrent::Array.new
end

Public Instance Methods

check_assets() click to toggle source
# File lib/fleek/connection.rb, line 22
def check_assets
  assets.each do |asset|
    transmit({
      identifier: 'asset_updated',
      asset: asset,
      new_url: helpers.path_to_stylesheet(asset, debug: false)
    }.to_json)
  end
end
receive(message) click to toggle source
# File lib/fleek/connection.rb, line 15
def receive(message)
  data = ActiveSupport::JSON.decode(message)
  if data['identifier'] == 'register_assets'
    assets.push(*data['assets'])
  end
end