Class: Ryodo::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/ryodo/parser.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeParser

Returns a new instance of Parser.



3
4
5
# File 'lib/ryodo/parser.rb', line 3

def initialize
  @rules = Ryodo::RuleSet.new
end

Class Method Details

.instanceObject



20
21
22
# File 'lib/ryodo/parser.rb', line 20

def instance
  @instance ||= new
end

.run(domain) ⇒ Object



16
17
18
# File 'lib/ryodo/parser.rb', line 16

def run(domain)
  instance.parse(domain)
end

Instance Method Details

#build_query(domain) ⇒ Object



7
8
9
# File 'lib/ryodo/parser.rb', line 7

def build_query(domain)
  domain.split(".").reverse
end

#parse(domain) ⇒ Object



11
12
13
# File 'lib/ryodo/parser.rb', line 11

def parse(domain)
  @rules.match build_query(domain)
end