Class: GraphdocRuby::Application

Inherits:
Object
  • Object
show all
Defined in:
lib/graphdoc-ruby/application.rb

Constant Summary collapse

Semaphore =
Mutex.new

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeApplication

Returns a new instance of Application.



29
30
31
32
33
# File 'lib/graphdoc-ruby/application.rb', line 29

def initialize
  generate_html if GraphdocRuby.config.run_time_generation

  @static = GraphdocRuby::Static.new(GraphdocRuby.config.output_directory)
end

Class Method Details

.call(env) ⇒ Object



9
10
11
12
# File 'lib/graphdoc-ruby/application.rb', line 9

def self.call(env)
  @application ||= new
  @application.call(env)
end

.graphdocObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/graphdoc-ruby/application.rb', line 14

def self.graphdoc
  config = GraphdocRuby.config
  config.assert_configuration!

  GraphdocRuby::Graphdoc.new(
    output: config.output_directory,
    executable: config.executable_path,
    endpoint: config.endpoint,
    overwrite: config.overwrite,
    mtime: config.mtime,
    query: config.evaluate_graphql_query,
    context: config.evaluate_graphql_context
  )
end

Instance Method Details

#call(env) ⇒ Object



35
36
37
# File 'lib/graphdoc-ruby/application.rb', line 35

def call(env)
  serve_static_file(env) || not_found
end