Class: Copland::Implementation::StartupClient

Inherits:
Object
  • Object
show all
Defined in:
lib/copland/impl/startup.rb

Overview

This wraps a single service as a client to the Startup service. It provides the necessary #before? and #after? abstractions required by the Orderer module (which is used by Startup to order the clients before starting them).

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(point, before, after) ⇒ StartupClient

Instantiate a new client that wraps the given service point, and its before and after lists. These lists should be arrays of the full names of other services.



59
60
61
62
63
# File 'lib/copland/impl/startup.rb', line 59

def initialize( point, before, after )
  @point = point
  @before = before
  @after = after
end

Instance Attribute Details

#afterObject (readonly)

The array of names of service points that should start before this service point.



54
55
56
# File 'lib/copland/impl/startup.rb', line 54

def after
  @after
end

#beforeObject (readonly)

The array of names of service points that should start after this service point.



50
51
52
# File 'lib/copland/impl/startup.rb', line 50

def before
  @before
end

#pointObject (readonly)

The service point that is wrapped by this object.



46
47
48
# File 'lib/copland/impl/startup.rb', line 46

def point
  @point
end

Instance Method Details

#after?(e) ⇒ Boolean

Returns true if self should be after before e.

Returns:

  • (Boolean)


72
73
74
75
# File 'lib/copland/impl/startup.rb', line 72

def after?( e )
  @after.include?( e.point.full_name ) ||
  e.before.include?( point.full_name )
end

#before?(e) ⇒ Boolean

Returns true if self should be started before e.

Returns:

  • (Boolean)


66
67
68
69
# File 'lib/copland/impl/startup.rb', line 66

def before?( e )
  @before.include?( e.point.full_name ) ||
  e.after.include?( point.full_name )
end