Sha256: 49022167cdc61d87dc13bc2ab5d6fcb9ffa1aec28a461bec0da9e607285b72de
Contents?: true
Size: 669 Bytes
Versions: 4
Compression:
Stored size: 669 Bytes
Contents
# frozen_string_literal: true module Motoko class Node attr_reader :identity def initialize(identity, facts) @identity = identity @facts = facts end def fact(name) result = @facts components = name.to_s.split('.') while (component = components.shift) case result when Hash result = result[component] when Array result = result[Integer(component)] when NilClass return nil end end result end class Choria < Motoko::Node def initialize(node) super(node[:sender], node[:data][:facts]) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
motoko-1.2.1 | lib/motoko/node.rb |
motoko-1.2.0 | lib/motoko/node.rb |
motoko-1.1.0 | lib/motoko/node.rb |
motoko-1.0.0 | lib/motoko/node.rb |