Class: Soy::Server

Inherits:
Object
  • Object
show all
Defined in:
lib/soy/server.rb

Overview

Container of data for a given page

Constant Summary collapse

DEFAULT_PORT =
4848

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(dir, port) ⇒ Server



19
20
21
22
23
24
25
# File 'lib/soy/server.rb', line 19

def initialize(dir, port)
  @dir = dir || Dir.pwd
  @port = port || DEFAULT_PORT
  @relative_output_dir = "build"
  @output_dir = "#{@dir}/#{@relative_output_dir}"
  @builder = Builder.new(@dir)
end

Class Method Details

.start(dir = Dir.pwd, port: DEFAULT_PORT) ⇒ Object



15
16
17
# File 'lib/soy/server.rb', line 15

def self.start(dir = Dir.pwd, port: DEFAULT_PORT)
  new(dir, port).call
end

Instance Method Details

#callObject



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

def call
  @builder.call
  start_watcher
  start_server
end