teaminsight/ns-options — pull request #15 by jcredding (2011-11-18 17:21:30+00:00)
Title: Add an :args rule to options

Setting the :args rule will pass the value of the rule along with the new value for the option to your custom type class. This can be used to support having an initialize method that requires multiple parameters.

```ruby
class MyTypeClass

def initialize(first, second)
# ... do something
end

end

module App
include NsOptions
options(:settings) do
option :special, MyTypeClass, :args => [ true, false ]
end
end

App.settings.special = "yes" # => does MyTypeClass.new("yes", true, false)
```

This should not be combined with built-in ruby types (`String`, `Integer`, etc...) as it will be ignored and not passed to them.

I also included proper handling for ruby's symbols. There is no clear way to type-cast objects to symbols, so if you specify symbol as your type class, then it will try to call `to_sym` on your object. This will cover the common case of string to symbol, but can error with certain values.

@kelredd - take a look, let me know what you think