Class: Misty::Services
- Inherits:
-
Object
- Object
- Misty::Services
- Includes:
- Enumerable
- Defined in:
- lib/misty/services.rb
Defined Under Namespace
Classes: Service
Instance Attribute Summary collapse
-
#services ⇒ Object
readonly
Returns the value of attribute services.
Instance Method Summary collapse
- #add(*args) ⇒ Object
- #each ⇒ Object
-
#initialize ⇒ Services
constructor
A new instance of Services.
- #names ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize ⇒ Services
Returns a new instance of Services.
35 36 37 |
# File 'lib/misty/services.rb', line 35 def initialize @services = [] end |
Instance Attribute Details
#services ⇒ Object (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 |
#each ⇒ Object
43 44 45 46 47 |
# File 'lib/misty/services.rb', line 43 def each @services.each do |service| yield service end end |
#names ⇒ Object
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_s ⇒ Object
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 |