Module: Apalo::Core::LogString
- Included in:
- String
- Defined in:
- lib/apalo/core/log_string.rb
Instance Method Summary collapse
- #image? ⇒ Boolean
- #is_a_bot? ⇒ Boolean
- #is_get? ⇒ Boolean
- #is_head? ⇒ Boolean
- #is_lock? ⇒ Boolean
- #is_options? ⇒ Boolean
- #is_post? ⇒ Boolean
- #is_propfind? ⇒ Boolean
- #is_put? ⇒ Boolean
- #test_regex(regex) ⇒ Object
Instance Method Details
#image? ⇒ Boolean
4 5 6 |
# File 'lib/apalo/core/log_string.rb', line 4 def image? self =~ /\.(png|PNG|jpg|JPG|gif|GIF|svg|SVG|jpeg|JPEG) HTTP\/1\.\d$/ end |
#is_a_bot? ⇒ Boolean
13 14 15 |
# File 'lib/apalo/core/log_string.rb', line 13 def is_a_bot? test_regex %r{^.*(Yahoo! Slurp|Googlebot|TurnitinBot|Twiceler|msnbot|Gigabot|Yandex|TurnitinBot|ia_archiver).*$} end |
#is_get? ⇒ Boolean
17 18 19 |
# File 'lib/apalo/core/log_string.rb', line 17 def is_get? test_regex %r{^GET .*$} end |
#is_head? ⇒ Boolean
29 30 31 |
# File 'lib/apalo/core/log_string.rb', line 29 def is_head? test_regex %r{^HEAD .*$} end |
#is_lock? ⇒ Boolean
41 42 43 |
# File 'lib/apalo/core/log_string.rb', line 41 def is_lock? test_regex %r{^LOCK .*$} end |
#is_options? ⇒ Boolean
25 26 27 |
# File 'lib/apalo/core/log_string.rb', line 25 def test_regex %r{^OPTIONS .*$} end |
#is_post? ⇒ Boolean
21 22 23 |
# File 'lib/apalo/core/log_string.rb', line 21 def is_post? test_regex %r{^POST .*$} end |
#is_propfind? ⇒ Boolean
33 34 35 |
# File 'lib/apalo/core/log_string.rb', line 33 def is_propfind? test_regex %r{^PROPFIND .*$} end |
#is_put? ⇒ Boolean
37 38 39 |
# File 'lib/apalo/core/log_string.rb', line 37 def is_put? test_regex %r{^PUT .*$} end |
#test_regex(regex) ⇒ Object
8 9 10 11 |
# File 'lib/apalo/core/log_string.rb', line 8 def test_regex(regex) return true if self =~ regex false end |