Class: DNSer::BaseRecord
Direct Known Subclasses
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#ttl_val ⇒ Object
readonly
Returns the value of attribute ttl_val.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Attributes inherited from Record
Instance Method Summary collapse
-
#initialize(domain, name, *args, &block) ⇒ BaseRecord
constructor
A new instance of BaseRecord.
- #ttl(v) ⇒ Object
- #type ⇒ Object
Methods inherited from Record
#comment, #full_host, #priority
Constructor Details
#initialize(domain, name, *args, &block) ⇒ BaseRecord
Returns a new instance of BaseRecord.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/dnser/records/base.rb', line 7 def initialize domain, name, *args, &block params = {} params = args.pop if args.last.is_a? Hash host = domain.host value = nil case args.size when 2 host = args[0] value = args[1] when 1 value = args[0] else raise DNSer::Record::EmptyValue.new(name), 'Content must be defined' end @name = name.to_s.upcase.to_sym @value = value params = {ttl: domain.ttl}.merge(params) params.each do |key, value| self.send "#{key}", value if self.respond_to? key end super domain, host, params instance_eval &block if block_given? end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/dnser/records/base.rb', line 5 def name @name end |
#ttl_val ⇒ Object (readonly)
Returns the value of attribute ttl_val.
3 4 5 |
# File 'lib/dnser/records/base.rb', line 3 def ttl_val @ttl_val end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
4 5 6 |
# File 'lib/dnser/records/base.rb', line 4 def value @value end |
Instance Method Details
#ttl(v) ⇒ Object
55 56 57 |
# File 'lib/dnser/records/base.rb', line 55 def ttl v @ttl_val = v end |
#type ⇒ Object
37 38 39 |
# File 'lib/dnser/records/base.rb', line 37 def type self.name end |