Sha256: 4d3b63231970dae1cf31918aa5a7942c031c64f80f63cdb2c735c5a8409d8286
Contents?: true
Size: 1.05 KB
Versions: 6
Compression:
Stored size: 1.05 KB
Contents
module Datacaster module Runtimes class Base def self.call(r, proc, *args) r.instance_exec(*args, &proc) end def self.send_to_parent(r, m, *args, &block) parent = r.instance_variable_get(:@parent) not_found!(m) if parent.nil? call(parent, -> { public_send(m, *args, &block) }) end def self.not_found!(m) raise NoMethodError.new("Method #{m.inspect} is not available in current runtime context") end def initialize(parent = nil) @parent = parent end def method_missing(m, *args, &block) self.class.send_to_parent(self, m, *args, &block) end def respond_to_missing?(m, include_private = false) !@parent.nil? && @parent.respond_to?(m, include_private) end def inspect "#<#{self.class.name} parent: #{@parent.inspect}>" end def to_s inspect end def Success(v) Datacaster.ValidResult(v) end def Failure(v) Datacaster.ErrorResult(v) end end end end
Version data entries
6 entries across 6 versions & 1 rubygems