Issue #1 open

Can't use Array for default value.

Gerry Gleason
created an issue

I have a simple array of strings for a default value, and I get an error because it tries and fails to create it as a Struct. Is there a work-around for this?

Example code:

require 'configurable'

class NameLogic include Configurable

BANNED_ARRAY = [ '/', '~', '|' ] configurable_options :banned_array, :joint, :banned_array => BANNED_ARRAY

Error: /usr/local/rvm/gems/ruby-1.9.3-rc1@r3/gems/ruby-configurable-1.0.2/lib/configurable/config_struct.rb:44:in new': identifier / needs to be constant (NameError) from /usr/local/rvm/gems/ruby-1.9.3-rc1@r3/gems/ruby-configurable-1.0.2/lib/configurable/config_struct.rb:44:innew' from /usr/local/rvm/gems/ruby-1.9.3-rc1@r3/gems/ruby-configurable-1.0.2/lib/configurable.rb:98:in create_struct' from /usr/local/rvm/gems/ruby-1.9.3-rc1@r3/gems/ruby-configurable-1.0.2/lib/configurable.rb:105:inblock in create_struct' from /usr/local/rvm/gems/ruby-1.9.3-rc1@r3/gems/ruby-configurable-1.0.2/lib/configurable.rb:101:in each' from /usr/local/rvm/gems/ruby-1.9.3-rc1@r3/gems/ruby-configurable-1.0.2/lib/configurable.rb:101:increate_struct' from /usr/local/rvm/gems/ruby-1.9.3-rc1@r3/gems/ruby-configurable-1.0.2/lib/configurable.rb:87:in configurable_options' from /home/gerry/work/namelogic/lib/name_logic.rb:27:in<class:NameLogic>' from /home/gerry/work/namelogic/lib/name_logic.rb:10:in `<top (required)>'

Comments (1)

  1. Log in to comment