Sha256: f99ac9a2f561bb2a0955b74dc98eee95f18f45d50b9439d8a717971f18a2f10c

Contents?: true

Size: 1.06 KB

Versions: 2

Compression:

Stored size: 1.06 KB

Contents

# YamlProperties

If you find yourself often setting app config in yaml files for different
environments etc. Then this can be quite useful to simply access those variables.

## Examples
```ruby
#usual bundler install
gem 'yaml_config'

#usage in your code
YamlProperties.redis_port
YamlProperties.smtp_server

# data in config/properties.yml
redis_port: 1369
smtp_server: smtp.example.com
```

Also can be added to a module or class like

```ruby
module YourFunkyConfigThing
  extend YamlProperties

  #Override filename like this
  def self.yaml_file
    ENV['SINATRA_ENV'] == 'development' ? 'config/properties.yml' : 'config/properties_production.yml'
  end
end


#Always reload e.g. in Rails dev environment
YamlProperties.dev_environment = Rails.env.development?
```


##For Cucumber etc
```ruby

#features/support/env.rb
After do |scenario|
  YamlProperties.reset!
end

#features/step_definitions/egg_steps.rb
Given /\AThere are \d+ eggs in a dozen\z/ |dozen|
  YamlProperties.override_attribute :egg, dozen
end
```

#Yadayada

Usual gem/bundler usage/contribution guidelines

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
shutl_yaml_properties-0.1.0 README.md
shutl_yaml_properties-0.0.13 README.md