Class: ClusterManagement::Service
- Inherits:
-
Object
- Object
- ClusterManagement::Service
- Defined in:
- lib/cluster_management/service.rb
Class Method Summary collapse
- .marker(extra_mark = nil) ⇒ Object
- .service_class(name) ⇒ Object
- .service_name ⇒ Object
- .tag(tag = nil) ⇒ Object
- .version(version = nil) ⇒ Object
Class Method Details
.marker(extra_mark = nil) ⇒ Object
20 21 22 |
# File 'lib/cluster_management/service.rb', line 20 def marker extra_mark = nil %(#{service_name}:#{version}#{":#{extra_mark}" if extra_mark}) end |
.service_class(name) ⇒ Object
24 25 26 27 |
# File 'lib/cluster_management/service.rb', line 24 def service_class name # dont'use constantize, it works wrong, and returns ::File instead of ::Services::File for example. eval("::Services::#{name.to_s.camelize}", TOPLEVEL_BINDING, __FILE__, __LINE__) end |
.service_name ⇒ Object
30 |
# File 'lib/cluster_management/service.rb', line 30 def service_name; name.split('::').last.underscore.to_sym end |
.tag(tag = nil) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/cluster_management/service.rb', line 11 def tag tag = nil if tag tag.must_be.a Symbol @tag = tag else @tag || raise("service :#{service_name} not tagged!") end end |
.version(version = nil) ⇒ Object
3 4 5 6 7 8 9 |
# File 'lib/cluster_management/service.rb', line 3 def version version = nil if version @version = version else @version ||= 1 end end |