Class: Misty::Services

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/misty/services.rb

Defined Under Namespace

Classes: Service

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeServices

Returns a new instance of Services.



35
36
37
# File 'lib/misty/services.rb', line 35

def initialize
  @services = []
end

Instance Attribute Details

#servicesObject (readonly)

Returns the value of attribute services.



33
34
35
# File 'lib/misty/services.rb', line 33

def services
  @services
end

Instance Method Details

#add(*args) ⇒ Object



39
40
41
# File 'lib/misty/services.rb', line 39

def add(*args)
  @services << Service.new(*args)
end

#eachObject



43
44
45
46
47
# File 'lib/misty/services.rb', line 43

def each
  @services.each do |service|
    yield service
  end
end

#namesObject



49
50
51
52
53
54
55
# File 'lib/misty/services.rb', line 49

def names
  service_names = []
  @services.each do |service|
    service_names << service.name
  end
  service_names
end

#to_sObject



57
58
59
60
61
62
63
# File 'lib/misty/services.rb', line 57

def to_s
  list = ""
  @services.each do |service|
    list << service.to_s + "\n"
  end
  list
end