Class: Marko::Service
- Inherits:
-
Object
- Object
- Marko::Service
- Defined in:
- lib/marko/gadgets/service.rb
Overview
Service like ServiceObject, Command, etc.
Direct Known Subclasses
Assembler, Loader, Marko::Services::Assemble, Marko::Services::Compile
Constant Summary collapse
- Failure =
Class.new(StandardError)
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(*args, **kwargs, &block) ⇒ Service
constructor
A new instance of Service.
Constructor Details
#initialize(*args, **kwargs, &block) ⇒ Service
Returns a new instance of Service.
40 41 42 43 44 |
# File 'lib/marko/gadgets/service.rb', line 40 def initialize(*args, **kwargs, &block) @args = args @kwargs = kwargs @block = block end |
Class Method Details
.call(*args, **kwargs, &block) ⇒ Object
28 29 30 |
# File 'lib/marko/gadgets/service.rb', line 28 def call(*args, **kwargs, &block) new(*args, **kwargs, &block).call end |
.inherited(klass) ⇒ Object
32 33 34 35 |
# File 'lib/marko/gadgets/service.rb', line 32 def inherited(klass) klass.const_set(:Failure, Class.new(klass::Failure)) super end |
Instance Method Details
#call ⇒ Object
46 47 48 |
# File 'lib/marko/gadgets/service.rb', line 46 def call fail Failure, "#{self.class.name}#call must be overrided" end |