Class: BGPView::Peers
- Inherits:
-
Object
- Object
- BGPView::Peers
- Defined in:
- lib/bgpview/peers.rb
Constant Summary collapse
- @@cache =
{}
Instance Attribute Summary collapse
-
#ipv4 ⇒ Object
readonly
Returns the value of attribute ipv4.
-
#ipv6 ⇒ Object
readonly
Returns the value of attribute ipv6.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(number) ⇒ Peers
constructor
A new instance of Peers.
Constructor Details
#initialize(number) ⇒ Peers
Returns a new instance of Peers.
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/bgpview/peers.rb', line 12 def initialize(number) BGPView::Number.check(number) peers = BGPView::API.call("asn/#{number}/peers") @ipv4 = extract_as(peers, 'ipv4') @ipv6 = extract_as(peers, 'ipv6') @@cache[number] = self end |
Instance Attribute Details
#ipv4 ⇒ Object (readonly)
Returns the value of attribute ipv4.
10 11 12 |
# File 'lib/bgpview/peers.rb', line 10 def ipv4 @ipv4 end |
#ipv6 ⇒ Object (readonly)
Returns the value of attribute ipv6.
10 11 12 |
# File 'lib/bgpview/peers.rb', line 10 def ipv6 @ipv6 end |
Class Method Details
.find(number) ⇒ Object
23 24 25 |
# File 'lib/bgpview/peers.rb', line 23 def self.find(number) @@cache.key?(number) ? @@cache[number] : new(number) end |