Sha256: 448cd254a85e20346a96e11383788f7543f5f345ddacc23a34196f5b76af08fe

Contents?: true

Size: 475 Bytes

Versions: 2

Compression:

Stored size: 475 Bytes

Contents

# frozen_string_literal: true

module YamlFileSettable
  include Sinclair::Settable
  extend Sinclair::Settable::ClassMethods

  read_with do |key|
    loaded_yaml[key.to_s]
  end

  def loaded_yaml
    YAML.load_file(setting_file)
  end

  def setting_file(file_path = @setting_file)
    @setting_file = file_path
  end
end

class YamlFileSettings
  extend YamlFileSettable

  setting_file './spec/support/files/config.yml'

  setting_with_options :timeout, default: 30
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sinclair-2.1.1 spec/support/models/yaml_file_settings.rb
sinclair-2.1.0 spec/support/models/yaml_file_settings.rb