Class: Record
- Inherits:
-
Object
- Object
- Record
- Defined in:
- lib/record.rb
Instance Attribute Summary collapse
-
#class_type ⇒ Object
Returns the value of attribute class_type.
-
#domain ⇒ Object
Create accessor methods.
-
#ip_address ⇒ Object
Returns the value of attribute ip_address.
-
#record_type ⇒ Object
Returns the value of attribute record_type.
-
#time_out ⇒ Object
Returns the value of attribute time_out.
Instance Method Summary collapse
-
#initialize(array_record) ⇒ Record
constructor
A new instance of Record.
Constructor Details
#initialize(array_record) ⇒ Record
Returns a new instance of Record.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/record.rb', line 10 def initialize(array_record) # Initialize instance variables @domain = array_record[0] @time_out = array_record[1] @class_type = array_record[2] @record_type = array_record[3] # MX Records have an extra column before the IP Address block if @class_type.eql?("MX") @ip_address = array_record[5] else @ip_address = array_record[4] end if @ip_address.include?("\n") @ip_address.delete!("\n") # Removes the "\n" character from the ip address end end |
Instance Attribute Details
#class_type ⇒ Object
Returns the value of attribute class_type.
6 7 8 |
# File 'lib/record.rb', line 6 def class_type @class_type end |
#domain ⇒ Object
Create accessor methods
4 5 6 |
# File 'lib/record.rb', line 4 def domain @domain end |
#ip_address ⇒ Object
Returns the value of attribute ip_address.
8 9 10 |
# File 'lib/record.rb', line 8 def ip_address @ip_address end |
#record_type ⇒ Object
Returns the value of attribute record_type.
7 8 9 |
# File 'lib/record.rb', line 7 def record_type @record_type end |
#time_out ⇒ Object
Returns the value of attribute time_out.
5 6 7 |
# File 'lib/record.rb', line 5 def time_out @time_out end |