Class: Virtuatable::Application

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/virtuatable/application.rb

Overview

Wrapping class to easily create builders.

Author:

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#builderVirtuatable::Builders::Base

Returns the base builder for the application.

Returns:



11
12
13
# File 'lib/virtuatable/application.rb', line 11

def builder
  @builder
end

Class Method Details

.builderVirtuatable::Builders::Base

Wrapper to simplify the call to instance.:builder

Returns:



42
43
44
# File 'lib/virtuatable/application.rb', line 42

def self.builder
  instance.builder
end

.load!(name, locations: caller_locations, path: '.') ⇒ Object

Loads the application in normal mode, call this from a config.ru file to load the environment, configuration, and require the necessary files.

Parameters:

  • name (String)

    the name of the service you’re loading.



16
17
18
19
20
21
22
23
24
25
# File 'lib/virtuatable/application.rb', line 16

def self.load!(name, locations: caller_locations, path: '.')
  builder = Virtuatable::Builders::Base.new(
    locations: locations,
    path: path,
    name: name
  )
  instance.builder = builder
  builder.load!
  builder
end

.load_tests!(name, locations: caller_locations, path: '..') ⇒ Object

Loads the application from a spec/spec_helper to load the specs.

Parameters:

  • name (String)

    the name of the service to load the specs of.



29
30
31
32
33
34
35
36
37
38
# File 'lib/virtuatable/application.rb', line 29

def self.load_tests!(name, locations: caller_locations, path: '..')
  builder = Virtuatable::Builders::Tests.new(
    locations: locations,
    path: path,
    name: name
  )
  instance.builder = builder
  builder.load!
  builder
end