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.



746
747
748
# File 'lib/webrobots/robotstxt.rb', line 746

def delay
  @delay
end

Instance Method Details

#compileObject



734
735
736
737
738
739
740
741
742
743
744
# File 'lib/webrobots/robotstxt.rb', line 734

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