Class: Gort::InvalidLine

Inherits:
Object
  • Object
show all
Defined in:
lib/gort/invalid_line.rb

Overview

Note:

Technically, the RFC doesn’t have invalid lines in its grammar but there are just too many broken robots.txt files on the internet.

Represents an invalid line in a robots.txt file.

An invalid line is a line that can not be parsed as a rule and is not a comment.

Instance Attribute Summary collapse

Formatting Methods collapse

Instance Method Summary collapse

Constructor Details

#initialize(text) ⇒ InvalidLine

Returns a new instance of InvalidLine.

Parameters:

  • text (String)

    content of the line



12
13
14
# File 'lib/gort/invalid_line.rb', line 12

def initialize(text)
  @value = text
end

Instance Attribute Details

#valueString (readonly)

Content of the line.

Returns:

  • (String)


18
19
20
# File 'lib/gort/invalid_line.rb', line 18

def value
  @value
end

Instance Method Details

#inspectString

A human readable representation of the invalid line.

Returns:

  • (String)


27
28
29
# File 'lib/gort/invalid_line.rb', line 27

def inspect
  %(#<#{self.class.name}:#{object_id} "#{value}">)
end

#pretty_print(pp) ⇒ void

This method returns an undefined value.

Produces a pretty human readable representation of the invalid line.

Parameters:

  • pp (PrettyPrint)

    pretty printer



38
39
40
# File 'lib/gort/invalid_line.rb', line 38

def pretty_print(pp)
  pp.text("#{self.class.name}/#{object_id}< #{value} >")
end