Class: Synvert::Core::Configuration
- Inherits:
-
Object
- Object
- Synvert::Core::Configuration
- Defined in:
- lib/synvert/core/configuration.rb
Overview
Synvert global configuration.
Class Attribute Summary collapse
-
.number_of_workers ⇒ Integer
Number of workers.
-
.only_paths ⇒ Array<String>
Get a list of only paths.
-
.respect_gitignore ⇒ Boolean
Check if respect .gitignore.
-
.root_path ⇒ String
Get the path.
-
.show_run_process ⇒ Boolean
Check if show run process.
-
.single_quote ⇒ Boolean
Use single quote or double quote.
-
.skip_paths ⇒ Array<String>
Get a list of skip paths.
-
.strict ⇒ Boolean
Returns the value of the strict flag.
- .strict, if strict is false, it will ignore ruby version and gem version check.= ⇒ Object writeonly
-
.tab_width ⇒ Integer
Returns the tab width used for indentation.
-
.test_result ⇒ String
Returns the value of the test_result flag.
- .test_result, default is 'actions', it can be 'actions' or 'new_source'.= ⇒ Object writeonly
Class Method Summary collapse
-
.with_temporary_configurations(configurations) { ... } ⇒ Object
Temporarily sets the specified configurations, executes the given block, and then restores the original configurations.
Class Attribute Details
.number_of_workers ⇒ Integer
Number of workers
66 67 68 |
# File 'lib/synvert/core/configuration.rb', line 66 def number_of_workers @number_of_workers || 1 end |
.only_paths ⇒ Array<String>
Get a list of only paths.
45 46 47 |
# File 'lib/synvert/core/configuration.rb', line 45 def only_paths @only_paths || [] end |
.respect_gitignore ⇒ Boolean
Check if respect .gitignore
52 53 54 |
# File 'lib/synvert/core/configuration.rb', line 52 def respect_gitignore @respect_gitignore.nil? ? true : @respect_gitignore end |
.root_path ⇒ String
Get the path.
31 32 33 |
# File 'lib/synvert/core/configuration.rb', line 31 def root_path @root_path || '.' end |
.show_run_process ⇒ Boolean
Check if show run process.
59 60 61 |
# File 'lib/synvert/core/configuration.rb', line 59 def show_run_process @show_run_process || false end |
.single_quote ⇒ Boolean
Use single quote or double quote.
73 74 75 |
# File 'lib/synvert/core/configuration.rb', line 73 def single_quote @single_quote.nil? ? true : @single_quote end |
.skip_paths ⇒ Array<String>
Get a list of skip paths.
38 39 40 |
# File 'lib/synvert/core/configuration.rb', line 38 def skip_paths @skip_paths || [] end |
.strict ⇒ Boolean
Returns the value of the strict flag.
If the strict flag is not set, it returns true by default.
91 92 93 |
# File 'lib/synvert/core/configuration.rb', line 91 def strict @strict.nil? ? true : @strict end |
.strict, if strict is false, it will ignore ruby version and gem version check.=(value) ⇒ Object (writeonly)
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/synvert/core/configuration.rb', line 17 attr_writer :root_path, :skip_paths, :only_paths, :respect_gitignore, :show_run_process, :number_of_workers, :single_quote, :tab_width, :strict, :test_result |
.tab_width ⇒ Integer
Returns the tab width used for indentation.
If the tab width is not explicitly set, it defaults to 2.
82 83 84 |
# File 'lib/synvert/core/configuration.rb', line 82 def tab_width @tab_width || 2 end |
.test_result ⇒ String
Returns the value of the test_result flag.
If the test_result flag is not set, it returns 'actions' by default.
100 101 102 |
# File 'lib/synvert/core/configuration.rb', line 100 def test_result @test_result || 'actions' end |
.test_result, default is 'actions', it can be 'actions' or 'new_source'.=(value) ⇒ Object (writeonly)
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/synvert/core/configuration.rb', line 17 attr_writer :root_path, :skip_paths, :only_paths, :respect_gitignore, :show_run_process, :number_of_workers, :single_quote, :tab_width, :strict, :test_result |
Class Method Details
.with_temporary_configurations(configurations) { ... } ⇒ Object
Temporarily sets the specified configurations, executes the given block, and then restores the original configurations.
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
# File 'lib/synvert/core/configuration.rb', line 113 def with_temporary_configurations(configurations, &block) old_instance_variables = instance_variables.reduce({}) do |hash, var| hash[var] = instance_variable_get(var) hash end configurations.each do |variable, value| instance_variable_set("@#{variable}", value) end block.call old_instance_variables.each do |var, value| instance_variable_set(var, value) end end |