Class: ServiceBase
- Inherits:
-
Object
- Object
- ServiceBase
- Defined in:
- lib/generators/service/templates/base/service_base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#cmd ⇒ Object
readonly
Returns the value of attribute cmd.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(command) ⇒ ServiceBase
constructor
A new instance of ServiceBase.
Constructor Details
#initialize(command) ⇒ ServiceBase
Returns a new instance of ServiceBase.
6 7 8 |
# File 'lib/generators/service/templates/base/service_base.rb', line 6 def initialize(command) @cmd = command end |
Instance Attribute Details
#cmd ⇒ Object (readonly)
Returns the value of attribute cmd.
4 5 6 |
# File 'lib/generators/service/templates/base/service_base.rb', line 4 def cmd @cmd end |
Class Method Details
.call(command) ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/generators/service/templates/base/service_base.rb', line 10 def self.call(command) raise Errors::InvalidCommand, command.class if command.invalid? obj = new(command) obj.call rescue StandardError => e error(e) obj.send(:rollback) raise e end |