Class: Masklen::Network
- Inherits:
-
Struct
- Object
- Struct
- Masklen::Network
- Defined in:
- lib/masklen/types.rb
Overview
Network and ASN data for an IP address.
Instance Attribute Summary collapse
-
#asn ⇒ Object
Returns the value of attribute asn.
-
#domain ⇒ Object
Returns the value of attribute domain.
-
#isp ⇒ Object
Returns the value of attribute isp.
-
#organization ⇒ Object
Returns the value of attribute organization.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Build a Network from a parsed JSON hash.
Instance Attribute Details
#asn ⇒ Object
Returns the value of attribute asn
32 33 34 |
# File 'lib/masklen/types.rb', line 32 def asn @asn end |
#domain ⇒ Object
Returns the value of attribute domain
32 33 34 |
# File 'lib/masklen/types.rb', line 32 def domain @domain end |
#isp ⇒ Object
Returns the value of attribute isp
32 33 34 |
# File 'lib/masklen/types.rb', line 32 def isp @isp end |
#organization ⇒ Object
Returns the value of attribute organization
32 33 34 |
# File 'lib/masklen/types.rb', line 32 def organization @organization end |
Class Method Details
.from_hash(hash) ⇒ Object
Build a Network from a parsed JSON hash. Returns nil if hash is nil.
40 41 42 43 44 45 46 47 48 49 |
# File 'lib/masklen/types.rb', line 40 def self.from_hash(hash) return nil if hash.nil? new( asn: hash["asn"], isp: hash["isp"], organization: hash["organization"], domain: hash["domain"] ) end |