Class: ForemanMaintain::Utils::Service::Abstract
- Inherits:
-
Object
- Object
- ForemanMaintain::Utils::Service::Abstract
- Includes:
- Comparable
- Defined in:
- lib/foreman_maintain/utils/service/abstract.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#priority ⇒ Object
readonly
Returns the value of attribute priority.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #disable ⇒ Object
- #enable ⇒ Object
- #exist? ⇒ Boolean
-
#initialize(name, priority, options = {}) ⇒ Abstract
constructor
A new instance of Abstract.
- #inspect ⇒ Object
- #matches?(service) ⇒ Boolean
- #running? ⇒ Boolean
- #start ⇒ Object
- #status ⇒ Object
- #stop ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(name, priority, options = {}) ⇒ Abstract
Returns a new instance of Abstract.
7 8 9 10 11 |
# File 'lib/foreman_maintain/utils/service/abstract.rb', line 7 def initialize(name, priority, = {}) @name = name @priority = priority @options = end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/foreman_maintain/utils/service/abstract.rb', line 5 def name @name end |
#priority ⇒ Object (readonly)
Returns the value of attribute priority.
5 6 7 |
# File 'lib/foreman_maintain/utils/service/abstract.rb', line 5 def priority @priority end |
Instance Method Details
#<=>(other) ⇒ Object
13 14 15 16 |
# File 'lib/foreman_maintain/utils/service/abstract.rb', line 13 def <=>(other) prio_cmp = @priority <=> other.priority prio_cmp == 0 ? @name <=> other.name : prio_cmp end |
#disable ⇒ Object
56 57 58 |
# File 'lib/foreman_maintain/utils/service/abstract.rb', line 56 def disable raise NotImplementedError end |
#enable ⇒ Object
52 53 54 |
# File 'lib/foreman_maintain/utils/service/abstract.rb', line 52 def enable raise NotImplementedError end |
#exist? ⇒ Boolean
36 37 38 |
# File 'lib/foreman_maintain/utils/service/abstract.rb', line 36 def exist? raise NotImplementedError end |
#inspect ⇒ Object
22 23 24 |
# File 'lib/foreman_maintain/utils/service/abstract.rb', line 22 def inspect "#{self.class.name.split('::').last}(#{@name} [#{@priority}])" end |
#matches?(service) ⇒ Boolean
26 27 28 29 30 31 32 33 34 |
# File 'lib/foreman_maintain/utils/service/abstract.rb', line 26 def matches?(service) if service.is_a? String service == @name elsif service.instance_of?(self.class) service.name == @name else false end end |
#running? ⇒ Boolean
60 61 62 |
# File 'lib/foreman_maintain/utils/service/abstract.rb', line 60 def running? raise NotImplementedError end |
#start ⇒ Object
44 45 46 |
# File 'lib/foreman_maintain/utils/service/abstract.rb', line 44 def start raise NotImplementedError end |
#status ⇒ Object
40 41 42 |
# File 'lib/foreman_maintain/utils/service/abstract.rb', line 40 def status raise NotImplementedError end |
#stop ⇒ Object
48 49 50 |
# File 'lib/foreman_maintain/utils/service/abstract.rb', line 48 def stop raise NotImplementedError end |
#to_s ⇒ Object
18 19 20 |
# File 'lib/foreman_maintain/utils/service/abstract.rb', line 18 def to_s @name end |