Class: Probot::ParsedLine
- Inherits:
-
Struct
- Object
- Struct
- Probot::ParsedLine
- Defined in:
- lib/probot.rb
Overview
ParedLine Note: In the case of ‘Sitemap: example.com/sitemap.xml’, raw_value needs to rejoin after splitting the URL.
Instance Attribute Summary collapse
-
#input_string ⇒ Object
Returns the value of attribute input_string.
Instance Method Summary collapse
- #agent? ⇒ Boolean
- #allow? ⇒ Boolean
- #clean_url ⇒ Object
- #clean_value ⇒ Object
- #crawl_delay? ⇒ Boolean
- #disallow? ⇒ Boolean
- #key ⇒ Object
- #raw_value ⇒ Object
- #sitemap? ⇒ Boolean
- #value ⇒ Object
Instance Attribute Details
#input_string ⇒ Object
Returns the value of attribute input_string
127 128 129 |
# File 'lib/probot.rb', line 127 def input_string @input_string end |
Instance Method Details
#agent? ⇒ Boolean
136 |
# File 'lib/probot.rb', line 136 def agent? = key == "user-agent" |
#allow? ⇒ Boolean
140 |
# File 'lib/probot.rb', line 140 def allow? = key == "allow" |
#clean_url ⇒ Object
134 |
# File 'lib/probot.rb', line 134 def clean_url = clean_value&.then { URI(_1).to_s } |
#clean_value ⇒ Object
132 |
# File 'lib/probot.rb', line 132 def clean_value = raw_value.split("#").first&.strip |
#crawl_delay? ⇒ Boolean
142 |
# File 'lib/probot.rb', line 142 def crawl_delay? = key == "crawl-delay" |
#disallow? ⇒ Boolean
138 |
# File 'lib/probot.rb', line 138 def disallow? = key == "disallow" |
#key ⇒ Object
128 |
# File 'lib/probot.rb', line 128 def key = input_string.split(":").first&.strip&.downcase |
#raw_value ⇒ Object
130 |
# File 'lib/probot.rb', line 130 def raw_value = input_string.split(":").slice(1..)&.join(":")&.strip |
#sitemap? ⇒ Boolean
144 |
# File 'lib/probot.rb', line 144 def sitemap? = key == "sitemap" |
#value ⇒ Object
146 147 148 149 150 151 152 153 154 155 |
# File 'lib/probot.rb', line 146 def value return clean_value.to_f if crawl_delay? return clean_url if disallow? || allow? raw_value rescue URI::InvalidURIError raw_value rescue ArgumentError raw_value end |