Class: Quark::MdkRuntime::Promise::CallbackEvent

Inherits:
DatawireQuarkCore::QuarkObject show all
Extended by:
DatawireQuarkCore::Static
Defined in:
lib/mdk_runtime/promise.rb

Constant Summary

Constants included from DatawireQuarkCore::Static

DatawireQuarkCore::Static::Unassigned

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from DatawireQuarkCore::Static

_lazy_statics, static, unlazy_statics

Methods inherited from DatawireQuarkCore::QuarkObject

#to_s

Constructor Details

#initialize(callable, next_, value) ⇒ CallbackEvent

Returns a new instance of CallbackEvent.



104
105
106
107
108
109
110
111
112
# File 'lib/mdk_runtime/promise.rb', line 104

def initialize(callable, next_, value)
    
    self.__init_fields__
    (self)._callable = callable
    (self)._next = next_
    (self)._value = value

    nil
end

Instance Attribute Details

#_callableObject

Returns the value of attribute _callable.



97
98
99
# File 'lib/mdk_runtime/promise.rb', line 97

def _callable
  @_callable
end

#_nextObject

Returns the value of attribute _next.



97
98
99
# File 'lib/mdk_runtime/promise.rb', line 97

def _next
  @_next
end

#_valueObject

Returns the value of attribute _value.



97
98
99
# File 'lib/mdk_runtime/promise.rb', line 97

def _value
  @_value
end

Instance Method Details

#__init_fields__Object



168
169
170
171
172
173
174
175
# File 'lib/mdk_runtime/promise.rb', line 168

def __init_fields__()
    
    self._callable = nil
    self._next = nil
    self._value = nil

    nil
end

#_getClassObject



130
131
132
133
134
135
# File 'lib/mdk_runtime/promise.rb', line 130

def _getClass()
    
    return "mdk_runtime.promise._CallbackEvent"

    nil
end

#_getField(name) ⇒ Object



137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# File 'lib/mdk_runtime/promise.rb', line 137

def _getField(name)
    
    if ((name) == ("_callable"))
        return (self)._callable
    end
    if ((name) == ("_next"))
        return (self)._next
    end
    if ((name) == ("_value"))
        return (self)._value
    end
    return nil

    nil
end

#_setField(name, value) ⇒ Object



153
154
155
156
157
158
159
160
161
162
163
164
165
166
# File 'lib/mdk_runtime/promise.rb', line 153

def _setField(name, value)
    
    if ((name) == ("_callable"))
        (self)._callable = ::DatawireQuarkCore.cast(value) { ::Quark.quark.UnaryCallable }
    end
    if ((name) == ("_next"))
        (self)._next = ::DatawireQuarkCore.cast(value) { ::Quark.mdk_runtime.promise.Promise }
    end
    if ((name) == ("_value"))
        (self)._value = value
    end

    nil
end

#deliverObject



117
118
119
120
121
122
123
124
125
126
127
128
# File 'lib/mdk_runtime/promise.rb', line 117

def deliver()
    
    result = ((self)._callable).call((self)._value)
    if (::Quark.quark.reflect.QuarkClass.get("mdk_runtime.promise.Promise").hasInstance(result))
        toChain = ::DatawireQuarkCore.cast(result) { ::Quark.mdk_runtime.promise.Promise }
        toChain.andFinally(::Quark.mdk_runtime.promise._ChainPromise.new((self)._next))
    else
        ::Quark.mdk_runtime.promise._fullfilPromise((self)._next, result)
    end

    nil
end