Class: Architect4r::Core::Configuration
- Inherits:
-
Object
- Object
- Architect4r::Core::Configuration
- Defined in:
- lib/architect4r/core/configuration.rb
Overview
Architect4r can be configured by creating a config/architect4r file and provide environment specific data.
Thanks to the sunspot-rails gem team, as this class is heavily inspired by their work!
development:
host: localhost
port: 7474
log_level: DEBUG
test:
host: localhost
port: 7474
log_level: OFF
production:
host: localhost
port: 8080
path: /my_neo_instance
log_level: WARNING
Instance Method Summary collapse
- #environment ⇒ Object
- #host ⇒ Object
-
#initialize(options = {}) ⇒ Configuration
constructor
A new instance of Configuration.
- #log_file ⇒ Object
- #log_level ⇒ Object
- #path ⇒ Object
- #port ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Configuration
Returns a new instance of Configuration.
25 26 27 28 29 |
# File 'lib/architect4r/core/configuration.rb', line 25 def initialize( = {}) ||= {} @environment = .delete(:environment).to_s if .has_key?(:environment) self.custom_configuration = .delete(:config) if .has_key?(:config) end |
Instance Method Details
#environment ⇒ Object
31 32 33 |
# File 'lib/architect4r/core/configuration.rb', line 31 def environment @environment ||= 'development' end |
#host ⇒ Object
35 36 37 38 39 40 41 42 |
# File 'lib/architect4r/core/configuration.rb', line 35 def host unless defined?(@hostname) @hostname = neo4j_url.host if neo4j_url @hostname ||= custom_configuration_from_key('host') @hostname ||= default_hostname end @hostname end |
#log_file ⇒ Object
67 68 69 |
# File 'lib/architect4r/core/configuration.rb', line 67 def log_file @log_file ||= (custom_configuration_from_key('log_file') || default_log_file_location ) end |
#log_level ⇒ Object
63 64 65 |
# File 'lib/architect4r/core/configuration.rb', line 63 def log_level @log_level ||= (custom_configuration_from_key('log_level') || default_log_level) end |
#path ⇒ Object
54 55 56 57 58 59 60 61 |
# File 'lib/architect4r/core/configuration.rb', line 54 def path unless defined?(@path) @path = neo4j_url.path if neo4j_url @path ||= custom_configuration_from_key('path') @path ||= default_path end @path end |
#port ⇒ Object
44 45 46 47 48 49 50 51 52 |
# File 'lib/architect4r/core/configuration.rb', line 44 def port unless defined?(@port) @port = neo4j_url.port if neo4j_url @port ||= custom_configuration_from_key('port') @port ||= default_port @port = @port.to_i end @port end |