Class: Whois::Scanners::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/whois/scanners/base.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(settings = nil) ⇒ Base

Returns a new instance of Base.



16
17
18
# File 'lib/whois/scanners/base.rb', line 16

def initialize(settings = nil)
  @settings = settings || {}
end

Instance Attribute Details

#settingsObject (readonly)

Returns the value of attribute settings.



14
15
16
# File 'lib/whois/scanners/base.rb', line 14

def settings
  @settings
end

Class Method Details

.tokenizer(name, &block) ⇒ Object



9
10
11
# File 'lib/whois/scanners/base.rb', line 9

def self.tokenizer(name, &block)
  define_method(name, &block)
end

Instance Method Details

#parse(content) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/whois/scanners/base.rb', line 20

def parse(content)
  # The temporary store.
  # Scanners may use this to store pointers, states or other flags.
  @tmp = {}

  # A super-simple AST store.
  @ast = {}

  @input = StringScanner.new(content)
  tokenize until @input.eos?

  @ast
end