Class: WebRobots::RobotsTxt::CrawlDelayLine

Inherits:
Line
  • Object
show all
Defined in:
lib/webrobots/robotstxt.rb

Instance Attribute Summary collapse

Attributes inherited from Line

#token, #value

Instance Method Summary collapse

Methods inherited from Line

#initialize

Constructor Details

This class inherits a constructor from WebRobots::RobotsTxt::Line

Instance Attribute Details

#delayObject (readonly)

Returns the value of attribute delay



733
734
735
# File 'lib/webrobots/robotstxt.rb', line 733

def delay
  @delay
end

Instance Method Details

#compileObject



721
722
723
724
725
726
727
728
729
730
731
# File 'lib/webrobots/robotstxt.rb', line 721

def compile
  case @value
  when /\A((0|[1-9][0-9]*)\.[0-9]+)/
    @delay = @value.to_f
  when /\A(0|[1-9][0-9]*)/
    @delay = @value.to_i
  else
    @delay = nil
  end
  self
end