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 parsing of ENV variable values to Boolean type #180

Merged
merged 1 commit into from
Oct 23, 2017

Conversation

mjgiarlo
Copy link
Contributor

@mjgiarlo mjgiarlo commented Oct 19, 2017

Fixes #178

(Discovered in samvera/hyku#1462. Heads-up, @tdonohue.)

@mjgiarlo mjgiarlo force-pushed the parse_boolean_env_values branch 2 times, most recently from 4ac4517 to d89ed7c Compare October 19, 2017 20:43
@mjgiarlo
Copy link
Contributor Author

@pkuczynski I can eliminate the CodeClimate issue by taking the logic from #__boolean and inlining it in #__value, but I didn't want to change the one-liner pattern going there. What do you advise? Should I make CodeClimate happy, or are there other changes you'd like to see?

tdonohue added a commit to samvera/hyku that referenced this pull request Oct 19, 2017
mjgiarlo added a commit to samvera/hyku that referenced this pull request Oct 19, 2017
tdonohue added a commit to samvera/hyku that referenced this pull request Oct 20, 2017
tdonohue added a commit to samvera/hyku that referenced this pull request Oct 20, 2017
tdonohue added a commit to samvera/hyku that referenced this pull request Oct 20, 2017
…ypatch

Update Gemfile to point at rubyconfig/config#180 branch for config gem
@pkuczynski
Copy link
Member

pkuczynski commented Oct 21, 2017

I would rather see this done as:

    # Try to convert string to a correct type
    def __value(v)
      case value
      when 'false'
        false
      when 'true'
        true
      else
        Integer(v) rescue Float(v) rescue v
      end
    end

@pkuczynski pkuczynski self-requested a review October 21, 2017 16:59
Copy link
Contributor Author

@mjgiarlo mjgiarlo left a comment

Choose a reason for hiding this comment

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

Dig the modification you made. I believe there may be a typo in it.

@@ -188,7 +188,14 @@ def __convert(h) #:nodoc:

# Try to convert string to a correct type
def __value(v)
Integer(v) rescue Float(v) rescue v
case value
Copy link
Contributor Author

Choose a reason for hiding this comment

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

s/value/v/ here, right?

Copy link
Member

Choose a reason for hiding this comment

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

yeah, totally! sorry!

@mjgiarlo mjgiarlo force-pushed the parse_boolean_env_values branch from 0eb432e to 36bb485 Compare October 23, 2017 15:11
@mjgiarlo
Copy link
Contributor Author

@pkuczynski I fixed a typo in the change you submitted, squashed commits, and pushed again. Thanks for the change! I suspect this is now ready to go.

When do you think 1.6.0 can get released with this change?

@pkuczynski pkuczynski merged commit a2ae5d7 into rubyconfig:master Oct 23, 2017
@pkuczynski
Copy link
Member

Done! Released as 1.5.1.

@pkuczynski
Copy link
Member

Thanks for your contributiuon :)

@mjgiarlo
Copy link
Contributor Author

Thanks for the useful gem, @pkuczynski!

@mjgiarlo mjgiarlo deleted the parse_boolean_env_values branch October 23, 2017 16:03
@pkuczynski pkuczynski added this to the 0.3.pre milestone Jan 8, 2020
alishaevn pushed a commit to rkuehn-uofl/hyku that referenced this pull request Apr 10, 2023
alishaevn pushed a commit to rkuehn-uofl/hyku that referenced this pull request Apr 10, 2023
alishaevn pushed a commit to rkuehn-uofl/hyku that referenced this pull request Apr 10, 2023
alishaevn pushed a commit to rkuehn-uofl/hyku that referenced this pull request Apr 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Support booleans with env_parse_values
2 participants