-
-
Save sts/da08d3710704c6a64cab to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a = ['1', '2'] | |
a.collect { if 0 == 1 ; 'foo' ; end }.inspect #=> "[nil, nil]" | |
a.collect { if 0 == 0 ; 'foo' ; end }.inspect #=> "[\"foo\", \"foo\"]" |
partitions = [
Hash[ :code => '0700', :sector_start => 63, :size_unit => 'GiB', :size => 500 ],
Hash[ :code => '8300', :sector_start => 63, :size_unit => 'GiB', :size => 500 ]
]
windows_partitions = partitions.select { |partition|
partition[:code] == '0700' and
partition[:sector_start] == 63 and
partition[:size_unit] == 'GiB' and
partition[:size].to_i > 400
}
windows_partitions.inspect
#=> [{:code=>"0700", :sector_start=>63, :size_unit=>"GiB", :size=>500}]
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I think you meant:
EDIT1:
In case you wanted to get elements that match the condition:
EDIT2:
In the case you want to
select
andmap
: