Class: Servicify::Object

Inherits:
Object
  • Object
show all
Defined in:
lib/servicify/object.rb

Direct Known Subclasses

ServiceResult

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#resultObject (readonly)

Returns the value of attribute result.



9
10
11
# File 'lib/servicify/object.rb', line 9

def result
  @result
end

Class Method Details

.call(*arg, **opts) ⇒ Object



4
5
6
# File 'lib/servicify/object.rb', line 4

def call(*arg, **opts)
  new(*arg, **opts).constructor
end

Instance Method Details

#callObject



28
29
30
# File 'lib/servicify/object.rb', line 28

def call
  fail NotImplementedError unless defined?(super)
end

#constructorObject



11
12
13
14
# File 'lib/servicify/object.rb', line 11

def constructor
  @result = call
  self
end

#errorsObject



24
25
26
# File 'lib/servicify/object.rb', line 24

def errors
  @errors ||= Servicify::Common::Errors.new
end

#failure?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/servicify/object.rb', line 20

def failure?
  errors.any?
end

#success?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/servicify/object.rb', line 16

def success?
  !failure?
end