* [ruby-core:94255] [Ruby master Misc#16096] each in each (multiple uses 'each')
[not found] <redmine.issue-16096.20190810214314@ruby-lang.org>
@ 2019-08-10 21:43 ` FreeKMan
2019-08-11 17:59 ` [ruby-core:94280] " John W Higgins
2019-08-10 22:27 ` [ruby-core:94257] " merch-redmine
` (4 subsequent siblings)
5 siblings, 1 reply; 7+ messages in thread
From: FreeKMan @ 2019-08-10 21:43 UTC (permalink / raw
To: ruby-core
Issue #16096 has been reported by D1mon (Dim F).
----------------------------------------
Misc #16096: each in each (multiple uses 'each')
https://bugs.ruby-lang.org/issues/16096
* Author: D1mon (Dim F)
* Status: Open
* Priority: Normal
* Assignee:
----------------------------------------
``` ruby
obj.each {|a|
a.some_method1.each {|b|
... # comes here (enter)
}
a.some_method2.each {|c|
... # does not enter here
}
}
# tried and that way. also does not go
for a in obj
for b in a.some_method1
... # comes here
end
for c in a.some_method2
... # does not enter here
end
end
```
help solve the problem. I’ve been suffering for 2 days.
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 7+ messages in thread
* [ruby-core:94257] [Ruby master Misc#16096] each in each (multiple uses 'each')
[not found] <redmine.issue-16096.20190810214314@ruby-lang.org>
2019-08-10 21:43 ` [ruby-core:94255] [Ruby master Misc#16096] each in each (multiple uses 'each') FreeKMan
@ 2019-08-10 22:27 ` merch-redmine
2019-08-10 22:35 ` [ruby-core:94258] " shevegen
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: merch-redmine @ 2019-08-10 22:27 UTC (permalink / raw
To: ruby-core
Issue #16096 has been updated by jeremyevans0 (Jeremy Evans).
Status changed from Open to Feedback
Can you explain what you are trying to do, and provide a self-contained example? It is not clear from the description or the code what you think the problem is. I can only guess that the object returned by `a.some_method2` has an `each` method that does not yield when called.
----------------------------------------
Misc #16096: each in each (multiple uses 'each')
https://bugs.ruby-lang.org/issues/16096#change-80572
* Author: D1mon (Dim F)
* Status: Feedback
* Priority: Normal
* Assignee:
----------------------------------------
``` ruby
obj.each {|a|
a.some_method1.each {|b|
... # comes here (enter)
}
a.some_method2.each {|c|
... # does not enter here
}
}
# tried and that way. also does not go
for a in obj
for b in a.some_method1
... # comes here
end
for c in a.some_method2
... # does not enter here
end
end
```
help solve the problem. I’ve been suffering for 2 days.
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 7+ messages in thread
* [ruby-core:94258] [Ruby master Misc#16096] each in each (multiple uses 'each')
[not found] <redmine.issue-16096.20190810214314@ruby-lang.org>
2019-08-10 21:43 ` [ruby-core:94255] [Ruby master Misc#16096] each in each (multiple uses 'each') FreeKMan
2019-08-10 22:27 ` [ruby-core:94257] " merch-redmine
@ 2019-08-10 22:35 ` shevegen
2019-08-10 23:15 ` [ruby-core:94260] " FreeKMan
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: shevegen @ 2019-08-10 22:35 UTC (permalink / raw
To: ruby-core
Issue #16096 has been updated by shevegen (Robert A. Heiler).
In ruby it is in general very rare that deeply nested (and multiple) .each
are necessary.
I recommend to you to use "pp" before you run the loop, such as:
pp obj
Perhaps you have an empty Array there - that happens to me sometimes
where I would otherwise get confused why .each is not running.
This is also why I love pp. :)
As Jeremy wrote, it is very likely to assume that something is
not quite right with .each for the object; or it is empty.
----------------------------------------
Misc #16096: each in each (multiple uses 'each')
https://bugs.ruby-lang.org/issues/16096#change-80573
* Author: D1mon (Dim F)
* Status: Feedback
* Priority: Normal
* Assignee:
----------------------------------------
``` ruby
obj.each {|a|
a.some_method1.each {|b|
... # comes here (enter)
}
a.some_method2.each {|c|
... # does not enter here
}
}
# tried and that way. also does not go
for a in obj
for b in a.some_method1
... # comes here
end
for c in a.some_method2
... # does not enter here
end
end
```
help solve the problem. I’ve been suffering for 2 days.
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 7+ messages in thread
* [ruby-core:94260] [Ruby master Misc#16096] each in each (multiple uses 'each')
[not found] <redmine.issue-16096.20190810214314@ruby-lang.org>
` (2 preceding siblings ...)
2019-08-10 22:35 ` [ruby-core:94258] " shevegen
@ 2019-08-10 23:15 ` FreeKMan
2019-08-10 23:32 ` [ruby-core:94262] " merch-redmine
2019-08-11 9:33 ` [ruby-core:94272] " FreeKMan
5 siblings, 0 replies; 7+ messages in thread
From: FreeKMan @ 2019-08-10 23:15 UTC (permalink / raw
To: ruby-core
Issue #16096 has been updated by D1mon (Dim F).
**selenium**
``` ruby
for el in driver.find_elements(xpath: <some_xpath>)
for e1 in el.find_elements(xpath: ...)
...
end
for e2 in el.find_elements(xpath: ...)
...
end
end
```
I need to do two searches in one pass
----------------------------------------
Misc #16096: each in each (multiple uses 'each')
https://bugs.ruby-lang.org/issues/16096#change-80575
* Author: D1mon (Dim F)
* Status: Feedback
* Priority: Normal
* Assignee:
----------------------------------------
``` ruby
obj.each {|a|
a.some_method1.each {|b|
... # comes here (enter)
}
a.some_method2.each {|c|
... # does not enter here
}
}
# tried and that way. also does not go
for a in obj
for b in a.some_method1
... # comes here
end
for c in a.some_method2
... # does not enter here
end
end
```
help solve the problem. I’ve been suffering for 2 days.
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 7+ messages in thread
* [ruby-core:94262] [Ruby master Misc#16096] each in each (multiple uses 'each')
[not found] <redmine.issue-16096.20190810214314@ruby-lang.org>
` (3 preceding siblings ...)
2019-08-10 23:15 ` [ruby-core:94260] " FreeKMan
@ 2019-08-10 23:32 ` merch-redmine
2019-08-11 9:33 ` [ruby-core:94272] " FreeKMan
5 siblings, 0 replies; 7+ messages in thread
From: merch-redmine @ 2019-08-10 23:32 UTC (permalink / raw
To: ruby-core
Issue #16096 has been updated by jeremyevans0 (Jeremy Evans).
Status changed from Feedback to Rejected
D1mon (Dim F) wrote:
> **selenium**
> ``` ruby
> for el in driver.find_elements(xpath: <some_xpath>)
> for e1 in el.find_elements(xpath: ...)
> ...
> end
> for e2 in el.find_elements(xpath: ...)
> ...
> end
> end
> ```
>
> I need to do two searches in one pass
You probably want something like:
```ruby
driver.find_elements(xpath: "...").each do |el|
(el.find_elements(xpath: "...").to_a + el.find_elements(xpath: "...").to_a).each do |e1|
# ...
end
end
```
Alternatively, you need an xpath expression that matches both elements you want to select (not sure if that is possible).
As this is not a bug report, I'm going to close this.
----------------------------------------
Misc #16096: each in each (multiple uses 'each')
https://bugs.ruby-lang.org/issues/16096#change-80577
* Author: D1mon (Dim F)
* Status: Rejected
* Priority: Normal
* Assignee:
----------------------------------------
``` ruby
obj.each {|a|
a.some_method1.each {|b|
... # comes here (enter)
}
a.some_method2.each {|c|
... # does not enter here
}
}
# tried and that way. also does not go
for a in obj
for b in a.some_method1
... # comes here
end
for c in a.some_method2
... # does not enter here
end
end
```
help solve the problem. I’ve been suffering for 2 days.
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 7+ messages in thread
* [ruby-core:94272] [Ruby master Misc#16096] each in each (multiple uses 'each')
[not found] <redmine.issue-16096.20190810214314@ruby-lang.org>
` (4 preceding siblings ...)
2019-08-10 23:32 ` [ruby-core:94262] " merch-redmine
@ 2019-08-11 9:33 ` FreeKMan
5 siblings, 0 replies; 7+ messages in thread
From: FreeKMan @ 2019-08-11 9:33 UTC (permalink / raw
To: ruby-core
Issue #16096 has been updated by D1mon (Dim F).
this method is not suitable since the 3rd search (find_elements) is also used.
Are you saying this is a bug? you can do issue?
----------------------------------------
Misc #16096: each in each (multiple uses 'each')
https://bugs.ruby-lang.org/issues/16096#change-80595
* Author: D1mon (Dim F)
* Status: Rejected
* Priority: Normal
* Assignee:
----------------------------------------
``` ruby
obj.each {|a|
a.some_method1.each {|b|
... # comes here (enter)
}
a.some_method2.each {|c|
... # does not enter here
}
}
# tried and that way. also does not go
for a in obj
for b in a.some_method1
... # comes here
end
for c in a.some_method2
... # does not enter here
end
end
```
help solve the problem. I’ve been suffering for 2 days.
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 7+ messages in thread
* [ruby-core:94280] Re: [Ruby master Misc#16096] each in each (multiple uses 'each')
2019-08-10 21:43 ` [ruby-core:94255] [Ruby master Misc#16096] each in each (multiple uses 'each') FreeKMan
@ 2019-08-11 17:59 ` John W Higgins
0 siblings, 0 replies; 7+ messages in thread
From: John W Higgins @ 2019-08-11 17:59 UTC (permalink / raw
To: Ruby developers
[-- Attachment #1.1: Type: text/plain, Size: 1460 bytes --]
There is no issue here at all.
a = [[1, 2, ,3, 4, 5]]
a.each do |x\
x.each do |y|
pp y
end
x.each do |z|
pp z
end
pp x
end
Works perfectly fine. Are you certain your second for actually has any
items to iterate? Remove the first embedded each loop and make sure they
both work independent of each other before assuming the nesting in the
issue.
John
On Sat, Aug 10, 2019 at 2:43 PM <FreeKMan@protonmail.com> wrote:
> Issue #16096 has been reported by D1mon (Dim F).
>
> ----------------------------------------
> Misc #16096: each in each (multiple uses 'each')
> https://bugs.ruby-lang.org/issues/16096
>
> * Author: D1mon (Dim F)
> * Status: Open
> * Priority: Normal
> * Assignee:
> ----------------------------------------
> ``` ruby
> obj.each {|a|
> a.some_method1.each {|b|
> ... # comes here (enter)
> }
> a.some_method2.each {|c|
> ... # does not enter here
> }
> }
>
> # tried and that way. also does not go
> for a in obj
> for b in a.some_method1
> ... # comes here
> end
> for c in a.some_method2
> ... # does not enter here
> end
> end
> ```
>
> help solve the problem. I’ve been suffering for 2 days.
>
>
>
>
> --
> https://bugs.ruby-lang.org/
>
> Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>
>
[-- Attachment #1.2: Type: text/html, Size: 2388 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2019-08-11 17:59 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <redmine.issue-16096.20190810214314@ruby-lang.org>
2019-08-10 21:43 ` [ruby-core:94255] [Ruby master Misc#16096] each in each (multiple uses 'each') FreeKMan
2019-08-11 17:59 ` [ruby-core:94280] " John W Higgins
2019-08-10 22:27 ` [ruby-core:94257] " merch-redmine
2019-08-10 22:35 ` [ruby-core:94258] " shevegen
2019-08-10 23:15 ` [ruby-core:94260] " FreeKMan
2019-08-10 23:32 ` [ruby-core:94262] " merch-redmine
2019-08-11 9:33 ` [ruby-core:94272] " FreeKMan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).