Module: LucidLocalOperation::Mixin

Defined in:
lib/isomorfeus_operation/lucid_local_operation/mixin.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#propsObject (readonly)

Returns the value of attribute props.



23
24
25
# File 'lib/isomorfeus_operation/lucid_local_operation/mixin.rb', line 23

def props
  @props
end

#step_resultObject

Returns the value of attribute step_result.



24
25
26
# File 'lib/isomorfeus_operation/lucid_local_operation/mixin.rb', line 24

def step_result
  @step_result
end

Class Method Details

.included(base) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/isomorfeus_operation/lucid_local_operation/mixin.rb', line 3

def self.included(base)
  if RUBY_ENGINE != 'opal'
    Isomorfeus.add_valid_operation_class(base) unless base == LucidLocalOperation::Base

    def pub_sub_client
      Isomorfeus.pub_sub_client
    end
  end

  base.extend(LucidPropDeclaration::Mixin)
  base.extend(LucidOperation::Steps)
  base.include(LucidOperation::PromiseRun)

  base.instance_exec do
    def promise_run(**props_hash)
      self.new(**props_hash).promise_run
    end
  end
end

Instance Method Details

#current_userObject



31
32
33
# File 'lib/isomorfeus_operation/lucid_local_operation/mixin.rb', line 31

def current_user
  Isomorfeus.current_user
end

#initialize(**props_hash) ⇒ Object



26
27
28
29
# File 'lib/isomorfeus_operation/lucid_local_operation/mixin.rb', line 26

def initialize(**props_hash)
  props_hash = self.class.validated_props(props_hash)
  @props = LucidProps.new(props_hash)
end