Class: Harvixture::Config
- Inherits:
-
Object
- Object
- Harvixture::Config
- Defined in:
- lib/harvixture/config.rb
Class Method Summary collapse
- .filename ⇒ Object
- .output_dir ⇒ Object
- .rails_env ⇒ Object
- .request_path ⇒ Object
- .update(attributes = {}) ⇒ Object
- .user_id ⇒ Object
Class Method Details
.filename ⇒ Object
30 31 32 |
# File 'lib/harvixture/config.rb', line 30 def filename File.join(home, '.harvixture_config.yml') end |
.output_dir ⇒ Object
10 11 12 |
# File 'lib/harvixture/config.rb', line 10 def output_dir values['output_dir'] end |
.rails_env ⇒ Object
4 5 6 |
# File 'lib/harvixture/config.rb', line 4 def rails_env values['rails_env'] end |
.request_path ⇒ Object
7 8 9 |
# File 'lib/harvixture/config.rb', line 7 def request_path values['request_path'] end |
.update(attributes = {}) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/harvixture/config.rb', line 17 def update(attributes = {}) new_values = { 'output_dir' => attributes[:output_dir] || attributes['output_dir'] || output_dir, 'rails_env' => attributes[:rails_env] || attributes['rails_env'] || rails_env, 'request_path' => attributes[:request_path] || attributes['request_path'] || request_path, 'user_id' => attributes[:user_id] || attributes['user_id'] || user_id, } File.open(filename, 'w+') {|f| f.puts YAML.dump(new_values)} Dir.glob(File.join(output_dir, '*.yml')).each {|f| File.delete(f) if File.exist?(f)} @values = nil values end |
.user_id ⇒ Object
13 14 15 |
# File 'lib/harvixture/config.rb', line 13 def user_id values['user_id'] end |