Class: Archipelago::Disco::Record

Inherits:
ServiceDescription show all
Defined in:
lib/archipelago/disco.rb

Overview

A class used to define an existing service.

Constant Summary

Constants inherited from ServiceDescription

ServiceDescription::IGNORABLE_ATTRIBUTES

Instance Attribute Summary

Attributes inherited from ServiceDescription

#attributes

Instance Method Summary collapse

Methods inherited from ServiceDescription

#matches?, #method_missing

Constructor Details

#initialize(hash) ⇒ Record

Initialize this Record with a hash that must contain an :service_id and a :validator.



254
255
256
257
258
# File 'lib/archipelago/disco.rb', line 254

def initialize(hash)
  raise "Record must have a :service_id" unless hash.include?(:service_id)
  raise "Record must have a :validator" unless hash.include?(:validator) && hash[:validator].respond_to?(:valid?)
  super(hash)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Archipelago::Disco::ServiceDescription

Instance Method Details

#valid?Boolean

Returns whether this service is still valid.

Returns:

  • (Boolean)


262
263
264
265
266
267
268
# File 'lib/archipelago/disco.rb', line 262

def valid?
  begin
    self[:validator].valid?
  rescue DRb::DRbError => e
    false
  end
end