Class: Idcf::Dns::Resources::Base
- Inherits:
-
Object
- Object
- Idcf::Dns::Resources::Base
- Defined in:
- lib/idcf/dns/resources/base.rb
Overview
Base resource class
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Class Method Summary collapse
- .class_name ⇒ Object
- .generate_readers ⇒ Object
- .inherited(subclass) ⇒ Object
- .validator_class ⇒ Object
Instance Method Summary collapse
-
#initialize(client, attributes = {}) ⇒ Base
constructor
Constructor.
-
#inspect ⇒ Object
Inspect this class.
Constructor Details
#initialize(client, attributes = {}) ⇒ Base
Constructor
39 40 41 42 |
# File 'lib/idcf/dns/resources/base.rb', line 39 def initialize(client, attributes = {}) @client = client self.attributes = attributes end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
8 9 10 |
# File 'lib/idcf/dns/resources/base.rb', line 8 def client @client end |
Class Method Details
.class_name ⇒ Object
17 18 19 |
# File 'lib/idcf/dns/resources/base.rb', line 17 def class_name to_s.gsub(/^#<Class|>$/, "").split(/::/).last end |
.generate_readers ⇒ Object
22 23 24 25 26 27 |
# File 'lib/idcf/dns/resources/base.rb', line 22 def generate_readers validator_class.valid_attributes.each do |name, properties| next if properties[:reader] == false attr_reader name end end |
.inherited(subclass) ⇒ Object
12 13 14 |
# File 'lib/idcf/dns/resources/base.rb', line 12 def inherited(subclass) subclass.send(:generate_readers) end |
.validator_class ⇒ Object
30 31 32 |
# File 'lib/idcf/dns/resources/base.rb', line 30 def validator_class "Idcf::Dns::Validators::#{class_name}".constantize end |
Instance Method Details
#inspect ⇒ Object
Inspect this class
45 46 47 |
# File 'lib/idcf/dns/resources/base.rb', line 45 def inspect "#<#{self.class}:0x%014x @name=#{name} @uuid=#{uuid}>" % [object_id] end |