Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

zookeeper: fomula always ignore --c option #15267

Closed
wants to merge 1 commit into from

2 participants

@repeatedly

'or' and '=' pair cause unexpected result in 'or' chain.

Behavior check code:

a = nil
b = nil
c = 0
p a or b or c     #=> nil - old code
p (a or b) or c   #=> nil
p ((a or b) or c) #=> 0   - fixed code
@repeatedly repeatedly zookeeper: fomula always ignore --c option
'or' and '=' pair cause unexpected result in 'or' chain.

Behavior check code:
```ruby
a = nil
b = nil
c = 0
p a or b or c     #=> nil - old code
p (a or b) or c   #=> nil
p ((a or b) or c) #=> 0   - fixed code
```
a19e360
@adamv
Owner

Should we be using || too?

@repeatedly

Yes, '||' works too.
I followed original 'or' code.

@adamv
Owner

I'm not a ruby expert; is or or || recommended in general?

@repeatedly

I don't know...
It depends on coding guidelines.

Personally, "or" is mainly used in some projects.

@adamv adamv closed this pull request from a commit
@adamv adamv zookeeper: fix option checking
Fixes #15267.
2183707
@adamv adamv closed this in 2183707
@repeatedly

Thanks!

@adamv
Owner

Thanks for the report

@allenhuang allenhuang referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
@theirix theirix referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
@snakeyroc3 snakeyroc3 referenced this pull request from a commit in snakeyroc3/homebrew
@adamv adamv zookeeper: fix option checking
Fixes #15267.
f246eec
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 3, 2012
  1. @repeatedly

    zookeeper: fomula always ignore --c option

    repeatedly authored
    'or' and '=' pair cause unexpected result in 'or' chain.
    
    Behavior check code:
    ```ruby
    a = nil
    b = nil
    c = 0
    p a or b or c     #=> nil - old code
    p (a or b) or c   #=> nil
    p ((a or b) or c) #=> 0   - fixed code
    ```
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 1 deletion.
  1. +1 −1  Library/Formula/zookeeper.rb
View
2  Library/Formula/zookeeper.rb
@@ -61,7 +61,7 @@ def install
build_python = build.include? "python"
build_perl = build.include? "perl"
- build_c = build_python or build_perl or build.include? "c"
+ build_c = ((build_python or build_perl) or build.include? "c")
# Build & install C libraries.
cd "src/c" do
Something went wrong with that request. Please try again.