https://github.com/bfontaine/set_const
Change a constant's value without warnings in Ruby
https://github.com/bfontaine/set_const
library ruby
Last synced: over 1 year ago
JSON representation
Change a constant's value without warnings in Ruby
- Host: GitHub
- URL: https://github.com/bfontaine/set_const
- Owner: bfontaine
- License: mit
- Created: 2014-04-25T15:58:36.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2017-12-23T00:02:07.000Z (over 8 years ago)
- Last Synced: 2025-03-23T23:43:41.782Z (over 1 year ago)
- Topics: library, ruby
- Language: Ruby
- Homepage:
- Size: 9.77 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# set\_const
[](https://travis-ci.org/bfontaine/set_const)
[](http://badge.fury.io/rb/set_const)
[](https://coveralls.io/r/bfontaine/set_const)
[](https://inch-ci.org/github/bfontaine/set_const)
**set\_const** is a (dangerous) gem that let you modify a constant’s value
without any warning. It’s useful for testing purposes, for example when your
code rely on a constant like `ARGV` or `RUBY_PLATFORM`.
## Install
```
gem install set_const
```
## Usage
```rb
require 'set_const'
set_const('ARGV', %w[--foo bar])
set_const('RUBY_PLATFORM', 'Foobar')
```
## Tests
```
$ git clone https://github.com/bfontaine/set_const.git
$ cd set_const
$ bundle install
$ bundle exec rake test
```