November 2013
Intermediate to advanced
224 pages
6h 9m
English
We stated that the configuration files for our command-line apps should not contain any configuration beyond default values for command-line options. This may sound limiting, but it’s a design constraint that will lead us to make our applications better.
Suppose we wanted to allow a power user to configure the level of compression that
gzip uses. gzip takes an
option of the form -# where
# can be any number from 1 to 9, with 1 indicating a
fast but weaker compression and with 9 being a slower but better compression. We might be
tempted to put this in our configuration file:
| | --- |
| | :force: true |
| | :username: admin |
| | :password: Sup3rS3cret! |
| | :compression: 1 |
| | if options[:gzip ... |
Read now
Unlock full access