Class: GitContext::Storage::YML
- Inherits:
-
Object
- Object
- GitContext::Storage::YML
- Defined in:
- lib/git_context/storage/yml.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
-
#initialize(config) ⇒ YML
constructor
A new instance of YML.
- #load ⇒ Object
- #save ⇒ Object
- #setup ⇒ Object
Constructor Details
#initialize(config) ⇒ YML
Returns a new instance of YML.
10 11 12 |
# File 'lib/git_context/storage/yml.rb', line 10 def initialize(config) @config = config end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
8 9 10 |
# File 'lib/git_context/storage/yml.rb', line 8 def config @config end |
Instance Method Details
#load ⇒ Object
20 21 22 23 24 25 |
# File 'lib/git_context/storage/yml.rb', line 20 def load return unless config_filepath && FileTest.exist?(config_filepath) load_profiles_from_file load_contexts_from_file end |
#save ⇒ Object
27 28 29 30 31 |
# File 'lib/git_context/storage/yml.rb', line 27 def save File.open(config_filepath, 'w') do |file| file.write(YAML.dump(serialized_data)) end end |
#setup ⇒ Object
14 15 16 17 18 |
# File 'lib/git_context/storage/yml.rb', line 14 def setup return if FileTest.exist?(config_filepath) FileUtils.touch(config_filepath) end |