Class: Misty::Services
- Inherits:
-
Object
- Object
- Misty::Services
- Includes:
- Enumerable
- Defined in:
- lib/misty/services.rb
Instance Attribute Summary collapse
-
#services ⇒ Object
readonly
Returns the value of attribute services.
Instance Method Summary collapse
- #add(*args) ⇒ Object
- #each ⇒ Object
- #get(name) ⇒ Object
-
#initialize ⇒ Services
constructor
A new instance of Services.
- #to_s ⇒ Object
- #types ⇒ Object
Constructor Details
#initialize ⇒ Services
Returns a new instance of Services.
10 11 12 |
# File 'lib/misty/services.rb', line 10 def initialize @services = [] end |
Instance Attribute Details
#services ⇒ Object (readonly)
Returns the value of attribute services.
8 9 10 |
# File 'lib/misty/services.rb', line 8 def services @services end |
Instance Method Details
#add(*args) ⇒ Object
14 15 16 |
# File 'lib/misty/services.rb', line 14 def add(*args) @services << Misty::Service.new(*args) end |
#each ⇒ Object
18 19 20 21 22 |
# File 'lib/misty/services.rb', line 18 def each @services.each do |s| yield s end end |
#get(name) ⇒ Object
24 25 26 27 28 29 |
# File 'lib/misty/services.rb', line 24 def get(name) each do |s| return s if s.name == name end nil end |
#to_s ⇒ Object
39 40 41 42 43 44 45 |
# File 'lib/misty/services.rb', line 39 def to_s list = '' each do |service| list << service.to_s + "\n" end list end |
#types ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/misty/services.rb', line 31 def types list = [] each do |s| list << s.type end list end |