Module: Irrc::Irr
- Included in:
- Query
- Defined in:
- lib/irrc/irr.rb
Class Method Summary collapse
- .host(name) ⇒ Object
- .irr?(name) ⇒ Boolean
-
.members_tag ⇒ Object
See RFC2622 / RFC4012 for details.
-
.route_tag(protocol) ⇒ Object
See RFC2622 / RFC4012 for details.
- .type(name) ⇒ Object
Instance Method Summary collapse
- #as_set? ⇒ Boolean
- #aut_num? ⇒ Boolean
- #object ⇒ Object
- #object=(object) ⇒ Object
-
#object_type ⇒ Object
Public: Returns the object type to query.
- #route_set? ⇒ Boolean
Class Method Details
.host(name) ⇒ Object
4 5 6 |
# File 'lib/irrc/irr.rb', line 4 def host(name) irr_list[irr_name(name)] end |
.irr?(name) ⇒ Boolean
8 9 10 |
# File 'lib/irrc/irr.rb', line 8 def irr?(name) irr_list.keys.include?(irr_name(name)) end |
.members_tag ⇒ Object
See RFC2622 / RFC4012 for details
17 18 19 |
# File 'lib/irrc/irr.rb', line 17 def members_tag /^(?:mp-)?members:\s*(.*)$/ end |
.route_tag(protocol) ⇒ Object
See RFC2622 / RFC4012 for details
22 23 24 25 26 27 28 29 |
# File 'lib/irrc/irr.rb', line 22 def route_tag(protocol) case protocol when :ipv4, 'ipv4' /^route:\s*(\S+)$/ when :ipv6, 'ipv6' /^route6:\s*(\S+)$/ end end |
.type(name) ⇒ Object
12 13 14 |
# File 'lib/irrc/irr.rb', line 12 def type(name) type_list[irr_name(name)] || type_list[fqdn(name)] end |
Instance Method Details
#as_set? ⇒ Boolean
105 106 107 |
# File 'lib/irrc/irr.rb', line 105 def as_set? object_type == 'as-set' end |
#aut_num? ⇒ Boolean
113 114 115 |
# File 'lib/irrc/irr.rb', line 113 def aut_num? object_type == 'aut-num' end |
#object ⇒ Object
82 83 84 |
# File 'lib/irrc/irr.rb', line 82 def object @object end |
#object=(object) ⇒ Object
86 87 88 |
# File 'lib/irrc/irr.rb', line 86 def object=(object) @object = object end |
#object_type ⇒ Object
Public: Returns the object type to query. See RFC2622 for details.
Returns: A String. (‘as-set’, ‘route-set’ or ‘aut-num’)
94 95 96 97 98 99 100 101 102 103 |
# File 'lib/irrc/irr.rb', line 94 def object_type case @object when /^AS-[\w-]+$|:AS-[\w-]+$/i 'as-set' when /^RS-[\w-]+$|:RS-[\w-]+$/i 'route-set' when /^AS\d+$|:AS\d+$/i 'aut-num' end end |
#route_set? ⇒ Boolean
109 110 111 |
# File 'lib/irrc/irr.rb', line 109 def route_set? object_type == 'route-set' end |