Module: ConfigMe::Runner
- Defined in:
- lib/config-me/runner.rb
Class Attribute Summary collapse
- 
  
    
      .definitions  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Returns the value of attribute definitions. 
- 
  
    
      .namespace  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Returns the value of attribute namespace. 
- 
  
    
      .options  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Returns the value of attribute options. 
Class Method Summary collapse
- .case_and_apply_action! ⇒ Object
- .importing_from_hash? ⇒ Boolean
- .importing_from_yaml? ⇒ Boolean
- .parse(namespace_or_options, &definitions) ⇒ Object
- .parse_execution_params!(namespace_or_options, &definitions) ⇒ Object
- .reading? ⇒ Boolean
- .set_current_namespace ⇒ Object
- .writing? ⇒ Boolean
Class Attribute Details
.definitions ⇒ Object
Returns the value of attribute definitions.
| 4 5 6 | # File 'lib/config-me/runner.rb', line 4 def definitions @definitions end | 
.namespace ⇒ Object
Returns the value of attribute namespace.
| 4 5 6 | # File 'lib/config-me/runner.rb', line 4 def namespace @namespace end | 
.options ⇒ Object
Returns the value of attribute options.
| 4 5 6 | # File 'lib/config-me/runner.rb', line 4 def @options end | 
Class Method Details
.case_and_apply_action! ⇒ Object
| 11 12 13 14 15 16 17 18 19 20 21 22 23 | # File 'lib/config-me/runner.rb', line 11 def case_and_apply_action! case when reading? then set_current_namespace when writing? ConfigMe::Importer.from_definitions namespace, definitions when importing_from_hash? ConfigMe::Importer.from_hash namespace, [:hash] when importing_from_yaml? ConfigMe::Importer.from_yaml namespace, [:yaml] else raise ConfigMe::UnrecognizedError.new end end | 
.importing_from_hash? ⇒ Boolean
| 57 58 59 | # File 'lib/config-me/runner.rb', line 57 def importing_from_hash? .has_key?(:hash) end | 
.importing_from_yaml? ⇒ Boolean
| 61 62 63 | # File 'lib/config-me/runner.rb', line 61 def importing_from_yaml? .has_key?(:yaml) end | 
.parse(namespace_or_options, &definitions) ⇒ Object
| 6 7 8 9 | # File 'lib/config-me/runner.rb', line 6 def parse , &definitions parse_execution_params! , &definitions case_and_apply_action! end | 
.parse_execution_params!(namespace_or_options, &definitions) ⇒ Object
| 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | # File 'lib/config-me/runner.rb', line 29 def parse_execution_params! , &definitions self.definitions = definitions case # ConfigMe.foo # ConfigMe(:development).foo when .is_a?(Symbol) || .is_a?(String) self.namespace = .to_sym self. = {} # ConfigMe(:from_hash => { :foo => :bar }) # ConfigMe(:namespace => :development) when .is_a?(Hash) self.namespace = .delete(:namespace) || ConfigMe::Defaults.namespace self. = else raise ConfigMe::UnrecognizedError.new end end | 
.reading? ⇒ Boolean
| 49 50 51 | # File 'lib/config-me/runner.rb', line 49 def reading? .empty? && definitions.nil? end | 
.set_current_namespace ⇒ Object
| 25 26 27 | # File 'lib/config-me/runner.rb', line 25 def set_current_namespace ConfigMe::Base.current_namespace = namespace end | 
.writing? ⇒ Boolean
| 53 54 55 | # File 'lib/config-me/runner.rb', line 53 def writing? .empty? && !definitions.nil? end |