Class: Hanami::Hanamirc Private
- Inherits:
-
Object
- Object
- Hanami::Hanamirc
- Defined in:
- lib/hanami/hanamirc.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Read the .hanamirc file in the root of the application
Constant Summary collapse
- FILE_NAME =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Hanamirc name file
'.hanamirc'.freeze
- DEFAULT_ARCHITECTURE =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Architecture default value
'container'.freeze
- APP_ARCHITECTURE =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Application architecture value
'app'.freeze
- ARCHITECTURE_KEY =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Architecture key for writing the hanamirc file
'architecture'.freeze
- PROJECT_NAME =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Project name for writing the hanamirc file
'project'.freeze
- DEFAULT_TEST_SUITE =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Test suite default value
'minitest'.freeze
- TEST_KEY =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Test suite key for writing the hanamirc file
'test'.freeze
- DEFAULT_TEMPLATE =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Template default value
'erb'.freeze
- TEMPLATE_KEY =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Template key for writing the hanamirc file
'template'.freeze
- SEPARATOR =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Key/value separator in hanamirc file
'='.freeze
Instance Method Summary collapse
-
#default_options ⇒ Object
private
Default values for writing the hanamirc file.
-
#exists? ⇒ Boolean
private
Check if hanamirc file exists.
-
#initialize(root) ⇒ Hanamirc
constructor
private
Initialize Hanamirc class with application’s root and environment options.
-
#options ⇒ Hanami::Utils::Hash
private
Read hanamirc file (if exists) and parse it’s values or return default.
Constructor Details
#initialize(root) ⇒ Hanamirc
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initialize Hanamirc class with application’s root and environment options.
91 92 93 |
# File 'lib/hanami/hanamirc.rb', line 91 def initialize(root) @root = root end |
Instance Method Details
#default_options ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Default values for writing the hanamirc file
117 118 119 120 121 122 123 124 |
# File 'lib/hanami/hanamirc.rb', line 117 def ||= Utils::Hash.new({ ARCHITECTURE_KEY => DEFAULT_ARCHITECTURE, PROJECT_NAME => project_name, TEST_KEY => DEFAULT_TEST_SUITE, TEMPLATE_KEY => DEFAULT_TEMPLATE }).symbolize!.freeze end |
#exists? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Check if hanamirc file exists
132 133 134 |
# File 'lib/hanami/hanamirc.rb', line 132 def exists? path_file.exist? end |
#options ⇒ Hanami::Utils::Hash
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Read hanamirc file (if exists) and parse it’s values or return default.
107 108 109 |
# File 'lib/hanami/hanamirc.rb', line 107 def ||= symbolize(.merge()) end |