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

#eql?, #hash, #matches?

Constructor Details

#initialize(hash) ⇒ Record

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



365
366
367
368
369
# File 'lib/archipelago/disco.rb', line 365

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

Instance Method Details

#valid?Boolean

Returns whether this service is still valid.

Returns:

  • (Boolean)


373
374
375
376
377
378
379
# File 'lib/archipelago/disco.rb', line 373

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