Class: Configuration
- Inherits:
-
Object
- Object
- Configuration
- Defined in:
- lib/cli/app/configuration.rb
Constant Summary collapse
- DEFAULT_COMPARISON_LEVEL =
1- COMPARISON_LEVELS =
{ 1 => :quick, 2 => :novice, 3 => :extensive, 4 => :full }
Instance Attribute Summary collapse
-
#comparison_level ⇒ Object
Returns the value of attribute comparison_level.
-
#excluded_models ⇒ Object
Returns the value of attribute excluded_models.
-
#output_path ⇒ Object
Returns the value of attribute output_path.
Instance Method Summary collapse
- #from_hash(hash_object) ⇒ Object
-
#initialize(excluded_models: [], output_path: "db_mirrored", comparison_level: DEFAULT_COMPARISON_LEVEL) ⇒ Configuration
constructor
A new instance of Configuration.
- #valid_attributes! ⇒ Object
Constructor Details
#initialize(excluded_models: [], output_path: "db_mirrored", comparison_level: DEFAULT_COMPARISON_LEVEL) ⇒ Configuration
Returns a new instance of Configuration.
13 14 15 16 17 |
# File 'lib/cli/app/configuration.rb', line 13 def initialize(excluded_models: [], output_path: "db_mirrored", comparison_level: DEFAULT_COMPARISON_LEVEL) self.excluded_models = excluded_models self.output_path = output_path self.comparison_level = COMPARISON_LEVELS[comparison_level] || DEFAULT_COMPARISON_LEVEL end |
Instance Attribute Details
#comparison_level ⇒ Object
Returns the value of attribute comparison_level.
2 3 4 |
# File 'lib/cli/app/configuration.rb', line 2 def comparison_level @comparison_level end |
#excluded_models ⇒ Object
Returns the value of attribute excluded_models.
2 3 4 |
# File 'lib/cli/app/configuration.rb', line 2 def excluded_models @excluded_models end |
#output_path ⇒ Object
Returns the value of attribute output_path.
2 3 4 |
# File 'lib/cli/app/configuration.rb', line 2 def output_path @output_path end |
Instance Method Details
#from_hash(hash_object) ⇒ Object
33 34 |
# File 'lib/cli/app/configuration.rb', line 33 def from_hash(hash_object) end |
#valid_attributes! ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/cli/app/configuration.rb', line 19 def valid_attributes! if !excluded_models.is_a?(Array) raise("Invalid excluded_models value! Was expecting an array") end if !output_path.present? raise("Invalid output_path value! Expected non empty string") end if COMPARISON_LEVELS.invert[comparison_level].nil? raise("Invalid comparison_level value! Expected a value between 1-4") end end |