Class: Fleek::Server

Inherits:
ActionCable::Server::Base
  • Object
show all
Defined in:
lib/fleek/server.rb,
lib/fleek/server/configuration.rb

Defined Under Namespace

Classes: Configuration

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(env) ⇒ Server

Returns a new instance of Server.



9
10
11
12
13
14
15
16
17
# File 'lib/fleek/server.rb', line 9

def initialize(env)
  super()
  @env = env
  @helpers = Fleek::Helpers.new(env)
  @listener = Listen.to(*@env.paths, latency: 0.1, wait_for_delay: 0.1) do |modified, added, removed|
    rebuild
  end
  @listener.start
end

Instance Attribute Details

#helpersObject (readonly)

Returns the value of attribute helpers.



7
8
9
# File 'lib/fleek/server.rb', line 7

def helpers
  @helpers
end

Class Method Details

.configObject



19
20
21
# File 'lib/fleek/server.rb', line 19

def self.config
  Fleek::Server::Configuration
end

Instance Method Details

#configObject



23
24
25
# File 'lib/fleek/server.rb', line 23

def config
  self.class.config
end

#rebuildObject



27
28
29
30
31
# File 'lib/fleek/server.rb', line 27

def rebuild
  connections.map do |connection|
    connection.send_async(:check_assets)
  end
end