Class: Fleek::Connection
- Inherits:
-
ActionCable::Connection::Base
- Object
- ActionCable::Connection::Base
- Fleek::Connection
- Defined in:
- lib/fleek/connection.rb
Instance Attribute Summary collapse
-
#assets ⇒ Object
readonly
Returns the value of attribute assets.
Instance Method Summary collapse
- #check_assets ⇒ Object
-
#initialize(*args) ⇒ Connection
constructor
A new instance of Connection.
- #receive(message) ⇒ Object
Constructor Details
#initialize(*args) ⇒ Connection
Returns a new instance of Connection.
10 11 12 13 |
# File 'lib/fleek/connection.rb', line 10 def initialize(*args) super @assets = Concurrent::Array.new end |
Instance Attribute Details
#assets ⇒ Object (readonly)
Returns the value of attribute assets.
6 7 8 |
# File 'lib/fleek/connection.rb', line 6 def assets @assets end |
Instance Method Details
#check_assets ⇒ Object
22 23 24 25 26 27 28 29 30 |
# 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) ⇒ Object
15 16 17 18 19 20 |
# File 'lib/fleek/connection.rb', line 15 def receive() data = ActiveSupport::JSON.decode() if data['identifier'] == 'register_assets' assets.push(*data['assets']) end end |