Class: Ryodo::Parser
- Inherits:
-
Object
- Object
- Ryodo::Parser
- Defined in:
- lib/ryodo/parser.rb
Class Method Summary collapse
Instance Method Summary collapse
- #build_query(domain) ⇒ Object
-
#initialize ⇒ Parser
constructor
A new instance of Parser.
- #parse(domain) ⇒ Object
Constructor Details
Class Method Details
.instance ⇒ Object
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 |