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 IsArray and IsPureArray checking config is an array #47

Merged
merged 1 commit into from
Jul 26, 2016

Conversation

urso
Copy link

@urso urso commented Jul 25, 2016

Closes #44

@ruflin
Copy link
Contributor

ruflin commented Jul 25, 2016

LGTM. Not 100% what do you mean by PureArray ?

@urso
Copy link
Author

urso commented Jul 26, 2016

in ucfg a *Config can be a map and an array at the same time to gain some flexibility. The IsArray method checks it's and array, but does not exclude the fact the config potentially being a map at the same time. The IsPureArray checks the Config being an array and have any named properties (is no dict/map/object).

@urso
Copy link
Author

urso commented Jul 26, 2016

changed implementation to provide IsArray and IsDict. IsPureArray has been removed in favor of users writing cfg.IsArray() && !cfg.IsDict().

- Update fields structure to provide accessors.
- Initialize dict in fields struct lazily when setting some key
@urso urso force-pushed the enh/44-is-array branch from 1afef8d to 97390eb Compare July 26, 2016 12:33
@urso urso removed the in progress label Jul 26, 2016
@@ -312,15 +317,15 @@ func (c cfgSub) SetContext(ctx context) {
}

func (c cfgSub) reify(opts *options) (interface{}, error) {
fields := c.c.fields.fields
arr := c.c.fields.arr
fields := c.c.fields.dict()
Copy link
Contributor

Choose a reason for hiding this comment

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

c.c. :-)

@ruflin ruflin merged commit bd7737a into elastic:master Jul 26, 2016
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.

2 participants