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.



735
736
737
# File 'lib/webrobots/robotstxt.rb', line 735

def delay
  @delay
end

Instance Method Details

#compileObject



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

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