Higo

Get started

Rubygems:

gem install higo

Gemfile:

gem 'higo'

Detailed usage examples can be found in the /examples directory. Supports reading from ruby objects and text files, JSON support coming soon.

Documentation can be found here.

Gem Story - TL;DR

Higo creates configuration objects dynamically. It also plays nice with methods you define. It can be subclassed or included as a module. Define settings in the block, pass values from a relative, dynamic file or URL path. All the same.

require 'higo'

class Configurable < Higo::Configurable
  configure do |conf|
      conf.greatness = 'pending'
      conf.host      = Hostname.new
  end
end

The configure block returns an instance of Higo::Configurable. The values themselves held instance variables. No need to define accessors ahead of time. Higo creates getter greatness(), setter host=(val)and predicate methods host?.

Gem Story -v

Higo enables the developer to create flexible configuration objects. It returns a Higo::Configurable object with getter, setter and predicate methods based on the values passed to the block.

Flexible meant two things (to me, at least). First, knowledge of the configuration values should not depend on static methods definition. Second, I prefer configuration that accepts multiple formats (like text, YAML)that could come from from remote sources.

I settled on the name after finding that fig, figgy were taken. Sure I could've named it figy, but that would be too confusing. So I settled on Higo.

Note-if you already defined method_missing in your class Higo will honor that and that is likely not what you want. Higo might not be right for you at this stage.

To Do List

  • Generate arbitrary configuration values
  • Improve support for subclasses that define method_missing
  • Add support for JSON files
  • Read from an external source
  • Improve documentation

Contributing

If you are developing against this gem (yay!), run bundle exec rake -T for list of rake tasks.

  1. Fork it ( https://github.com/rhodee/higo/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request