Class: FeatureFlagger::ManifestSources::YAMLWithBackupToStorage

Inherits:
Object
  • Object
show all
Defined in:
lib/feature_flagger/manifest_sources/yaml_with_backup_to_storage.rb

Instance Method Summary collapse

Constructor Details

#initialize(storage, yaml_path = nil) ⇒ YAMLWithBackupToStorage

Returns a new instance of YAMLWithBackupToStorage.



4
5
6
7
# File 'lib/feature_flagger/manifest_sources/yaml_with_backup_to_storage.rb', line 4

def initialize(storage, yaml_path = nil)
  @yaml_path = yaml_path || ("#{Rails.root}/config/rollout.yml" if defined?(Rails))
  @storage   = storage
end

Instance Method Details

#resolved_infoObject



9
10
11
12
13
14
15
# File 'lib/feature_flagger/manifest_sources/yaml_with_backup_to_storage.rb', line 9

def resolved_info
  @resolved_info ||= begin
    yaml_data = YAML.load_file(@yaml_path) if @yaml_path
    @storage.write_manifest_backup(YAML.dump(yaml_data))
    yaml_data
  end
end