Class: Orbit::Config

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/orbit/config.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Singleton

included, #instantiate

Constructor Details

#initializeConfig

Returns a new instance of Config.



14
15
16
17
18
# File 'lib/orbit/config.rb', line 14

def initialize
  instantiate

  set_default_config
end

Instance Attribute Details

#app_pathObject

Returns the value of attribute app_path.



9
10
11
# File 'lib/orbit/config.rb', line 9

def app_path
  @app_path
end

#log_appnameObject

Returns the value of attribute log_appname.



9
10
11
# File 'lib/orbit/config.rb', line 9

def log_appname
  @log_appname
end

#log_fileObject

Returns the value of attribute log_file.



9
10
11
# File 'lib/orbit/config.rb', line 9

def log_file
  @log_file
end

#log_levelObject

Returns the value of attribute log_level.



9
10
11
# File 'lib/orbit/config.rb', line 9

def log_level
  @log_level
end

#logger_classObject

Returns the value of attribute logger_class.



9
10
11
# File 'lib/orbit/config.rb', line 9

def logger_class
  @logger_class
end

#path_classObject

Returns the value of attribute path_class.



9
10
11
# File 'lib/orbit/config.rb', line 9

def path_class
  @path_class
end

#rack_logger_classObject

Returns the value of attribute rack_logger_class.



9
10
11
# File 'lib/orbit/config.rb', line 9

def rack_logger_class
  @rack_logger_class
end

#request_classObject

Returns the value of attribute request_class.



9
10
11
# File 'lib/orbit/config.rb', line 9

def request_class
  @request_class
end

#response_classObject

Returns the value of attribute response_class.



9
10
11
# File 'lib/orbit/config.rb', line 9

def response_class
  @response_class
end

#route_classObject

Returns the value of attribute route_class.



9
10
11
# File 'lib/orbit/config.rb', line 9

def route_class
  @route_class
end

#router_classObject

Returns the value of attribute router_class.



9
10
11
# File 'lib/orbit/config.rb', line 9

def router_class
  @router_class
end

#session_optionsObject

Returns the value of attribute session_options.



9
10
11
# File 'lib/orbit/config.rb', line 9

def session_options
  @session_options
end

#session_secretObject

Returns the value of attribute session_secret.



9
10
11
# File 'lib/orbit/config.rb', line 9

def session_secret
  @session_secret
end

#static_files_pathObject

Returns the value of attribute static_files_path.



9
10
11
# File 'lib/orbit/config.rb', line 9

def static_files_path
  @static_files_path
end

Class Method Details

.app_pathObject



41
42
43
# File 'lib/orbit/config.rb', line 41

def self.app_path
  @instance.app_path
end

.loggerObject



57
58
59
60
61
62
63
64
# File 'lib/orbit/config.rb', line 57

def self.logger
  @_logger ||= begin
    logger_class.new(@instance.log_file).tap do |logger|
      logger.level = @instance.log_level
      logger.progname = @instance.log_appname
    end
  end
end

.logger_classObject



53
54
55
# File 'lib/orbit/config.rb', line 53

def self.logger_class
  @instance.logger_class
end

.path_classObject



66
67
68
# File 'lib/orbit/config.rb', line 66

def self.path_class
  @instance.path_class
end

.request_classObject



70
71
72
# File 'lib/orbit/config.rb', line 70

def self.request_class
  @instance.request_class
end

.response_classObject



74
75
76
# File 'lib/orbit/config.rb', line 74

def self.response_class
  @instance.response_class
end

.route_classObject



78
79
80
# File 'lib/orbit/config.rb', line 78

def self.route_class
  @instance.route_class
end

.router_classObject



82
83
84
# File 'lib/orbit/config.rb', line 82

def self.router_class
  @instance.router_class
end

.session_optionsObject



45
46
47
# File 'lib/orbit/config.rb', line 45

def self.session_options
  @instance.session_options
end

.session_secretObject



86
87
88
# File 'lib/orbit/config.rb', line 86

def self.session_secret
  @instance.session_secret
end

.static_files_pathObject



49
50
51
# File 'lib/orbit/config.rb', line 49

def self.static_files_path
  @instance.static_files_path
end

Instance Method Details

#set_default_configObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/orbit/config.rb', line 20

def set_default_config
  @app_path          = 'app'
  @static_files_path = ["/media"]
  @session_secret    = 'session_secret'

  # Logging options
  @logger_class = Logger
  @log_level = Logger::DEBUG
  @log_file = STDOUT
  @log_appname = 'Orbit App'

  # Classes
  @rack_logger_class = Rack::Logger
  @path_class   = Orbit::Routing::Path
  @request_class = Orbit::Request
  @response_class = Orbit::Response
  @route_class  = Orbit::Routing::Route
  @router_class = Orbit::Router
  @session_options = {}
end