Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add simplified syntax for hash and array #875

Merged
merged 4 commits into from
Apr 4, 2016

Conversation

tagomoris
Copy link
Member

  • to specify values with very simple comma (and colon for key-value separator)
  • to re-format values because comma-separated values doesn't have type information

It looks to satisfy various use-cases of 3rd party plugins, and this change is just additional
change to allow format which is currently denied as ConfigError.

 * to specify values with very simple comma (and colon for key-value separator)
 * to re-format values because comma-separated values doesn't have type information

It looks to satisfy various use-cases of 3rd party plugins, and this change is just additional
change to allow format which is currently denied as ConfigError.
@tagomoris
Copy link
Member Author

This change is exclusive with #874

@sonots
Copy link
Member

sonots commented Mar 31, 2016

I prefer this than #874

@@ -124,10 +124,33 @@ class TestConfigTypes < ::Test::Unit::TestCase

test 'hash' do
assert_equal({"x"=>"v","k"=>1}, Config::HASH_TYPE.call('{"x":"v","k":1}', {}))
assert_equal({"x"=>"v","k"=>"1"}, Config::HASH_TYPE.call('x:v,k:1', {}))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a test a hash with , surrounded by spaces?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -80,19 +80,58 @@ def self.bool_value(str)
SIZE_TYPE = Proc.new { |val, opts| Config.size_value(val) }
BOOL_TYPE = Proc.new { |val, opts| Config.bool_value(val) }
TIME_TYPE = Proc.new { |val, opts| Config.time_value(val) }

REFORMAT_VALUES = ->(type, value) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why REFORMAT_VALUES? REFORMAT_VALUE?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed to REFORMAT_VALUE

@tagomoris tagomoris merged commit 8a1c582 into master Apr 4, 2016
@tagomoris
Copy link
Member Author

Merged.

@tagomoris tagomoris deleted the add-simple-format-for-hash-and-array branch May 17, 2016 07:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants