mirror of
https://github.com/dkam/probot.git
synced 2025-12-28 09:14:53 +00:00
Investigate using flip-flop operator? #1
Owner
probot/lib/probot.rb
Lines 82 to 88 in 45c1b001cd
if data.agent? |
|
if subsequent_agent |
|
@current_agents << data.value |
|
else |
|
@current_agents = [data.value] |
|
subsequent_agent = true |
|
end |
https://git.booko.info/dkam/probot/src/commit/45c1b001cd499f0517298aa65bc28942b2277e8b/lib/probot.rb#L82-L88
Author
Owner
```ruby
if data.agent?
# Flip-flop: ON when we see User-agent, OFF when we see anything else
if data.agent? .. !data.agent?
@current_agents << data.value
else
@current_agents = [data.value]
end
@current_agents.each { |agent| rules[agent] ||= {"disallow" => [], "allow" => [], "crawl_delay" => 0} }
next
end
```
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?