module PublicSuffix::Parser

Overview

Defines the .parse method for parsing rules.

Defined in:

public_suffix/parser.cr

Class Method Summary

Class Method Detail

def self.parse(rules : Enumerable(String)) #

Parses rules into internal representation.

Parsing the following:

com
*.jp
*.hokkaido.jp
*.tokyo.jp
!pref.hokkaido.jp
!metro.tokyo.jp

Yields:

Term{
  "com" => Term{:term => true},
  "jp" => Term{
    "tokyo" => Term{"!metro" => Term{:term => true}, "*" => Term{:term => true}},
    "hokkaido" => Term{"!pref" => Term{:term => true}, "*" => Term{:term => true}},
    "*" => Term{:term => true}
  }
}

[View source]