Class: TeamCymru::ASNRecord
- Inherits:
-
Struct
- Object
- Struct
- TeamCymru::ASNRecord
- Defined in:
- lib/teamcymru/asnclient.rb
Instance Attribute Summary collapse
-
#alloc ⇒ Object
Returns the value of attribute alloc.
-
#asn ⇒ Object
Returns the value of attribute asn.
-
#cc ⇒ Object
Returns the value of attribute cc.
-
#cidr ⇒ Object
Returns the value of attribute cidr.
-
#data ⇒ Object
Returns the value of attribute data.
-
#ip ⇒ Object
Returns the value of attribute ip.
-
#nic ⇒ Object
Returns the value of attribute nic.
-
#org ⇒ Object
Returns the value of attribute org.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#alloc ⇒ Object
Returns the value of attribute alloc
6 7 8 |
# File 'lib/teamcymru/asnclient.rb', line 6 def alloc @alloc end |
#asn ⇒ Object
Returns the value of attribute asn
6 7 8 |
# File 'lib/teamcymru/asnclient.rb', line 6 def asn @asn end |
#cc ⇒ Object
Returns the value of attribute cc
6 7 8 |
# File 'lib/teamcymru/asnclient.rb', line 6 def cc @cc end |
#cidr ⇒ Object
Returns the value of attribute cidr
6 7 8 |
# File 'lib/teamcymru/asnclient.rb', line 6 def cidr @cidr end |
#data ⇒ Object
Returns the value of attribute data
6 7 8 |
# File 'lib/teamcymru/asnclient.rb', line 6 def data @data end |
#ip ⇒ Object
Returns the value of attribute ip
6 7 8 |
# File 'lib/teamcymru/asnclient.rb', line 6 def ip @ip end |
#nic ⇒ Object
Returns the value of attribute nic
6 7 8 |
# File 'lib/teamcymru/asnclient.rb', line 6 def nic @nic end |
#org ⇒ Object
Returns the value of attribute org
6 7 8 |
# File 'lib/teamcymru/asnclient.rb', line 6 def org @org end |
Class Method Details
.from_s(str) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/teamcymru/asnclient.rb', line 10 def ASNRecord::from_s(str) args = str.chomp.split(/\|/).map{|x| x.strip} if args.length == 7 args.insert(6,'') elsif args.length == 5 # used for AS lookups args.insert(2,'') args.insert(2,'') args.insert(6,'') end ASNRecord.new(*args) end |
Instance Method Details
#cached=(cached) ⇒ Object
21 22 23 |
# File 'lib/teamcymru/asnclient.rb', line 21 def cached=(cached) @cached = cached end |
#from_cache? ⇒ Boolean
24 25 26 |
# File 'lib/teamcymru/asnclient.rb', line 24 def from_cache? @cached || false end |
#to_s ⇒ Object
7 8 9 |
# File 'lib/teamcymru/asnclient.rb', line 7 def to_s "#{self.asn.ljust(8)}| #{self.ip.ljust(17)}| #{self.cidr.ljust(20)}| #{self.cc.ljust(3)}| #{self.nic.ljust(9)}| #{self.alloc.ljust(11)}| #{self.data} | #{self.org}" end |