Module: Apalo::Core::LogString

Included in:
String
Defined in:
lib/apalo/core/log_string.rb

Instance Method Summary collapse

Instance Method Details

#image?Boolean

Returns:

  • (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

Returns:

  • (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

Returns:

  • (Boolean)


17
18
19
# File 'lib/apalo/core/log_string.rb', line 17

def is_get?
  test_regex %r{^GET .*$}
end

#is_head?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/apalo/core/log_string.rb', line 29

def is_head?
  test_regex %r{^HEAD .*$}
end

#is_lock?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/apalo/core/log_string.rb', line 41

def is_lock?
  test_regex %r{^LOCK .*$}
end

#is_options?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/apalo/core/log_string.rb', line 25

def is_options?
  test_regex %r{^OPTIONS .*$}
end

#is_post?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/apalo/core/log_string.rb', line 21

def is_post?
  test_regex %r{^POST .*$}
end

#is_propfind?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/apalo/core/log_string.rb', line 33

def is_propfind?
  test_regex %r{^PROPFIND .*$}
end

#is_put?Boolean

Returns:

  • (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