Class: DNSRecord
- Inherits:
-
Object
- Object
- DNSRecord
- Defined in:
- lib/DNSResolver.rb
Instance Attribute Summary collapse
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#timeStamp ⇒ Object
Returns the value of attribute timeStamp.
Instance Method Summary collapse
-
#initialize ⇒ DNSRecord
constructor
A new instance of DNSRecord.
- #resolve(ip) ⇒ Object
Constructor Details
#initialize ⇒ DNSRecord
Returns a new instance of DNSRecord.
21 22 23 |
# File 'lib/DNSResolver.rb', line 21 def initialize @host = nil end |
Instance Attribute Details
#host ⇒ Object (readonly)
Returns the value of attribute host.
18 19 20 |
# File 'lib/DNSResolver.rb', line 18 def host @host end |
#timeStamp ⇒ Object
Returns the value of attribute timeStamp.
19 20 21 |
# File 'lib/DNSResolver.rb', line 19 def timeStamp @timeStamp end |
Instance Method Details
#resolve(ip) ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/DNSResolver.rb', line 25 def resolve(ip) begin a = Socket.gethostbyname(ip) @host = Socket.gethostbyaddr(a[3], a[2])[0] rescue @host = ip end @timeStamp = Time.now() end |