Sha256: e0240986e3433527df7bf80ce4d7d66ae0b2264a1dde502b37489e174fa23063
Contents?: true
Size: 811 Bytes
Versions: 156
Compression:
Stored size: 811 Bytes
Contents
# frozen_string_literal: true require 'eac_ruby_utils/console/speaker/node' module EacRubyUtils module Console module Speaker class << self def current_node nodes_stack.last end def on_node(&block) push yield(*(block.arity.zero? ? [] : [current_node])) ensure pop end def push nodes_stack << ::EacRubyUtils::Console::Speaker::Node.new current_node end def pop return nodes_stack.pop if nodes_stack.count > 1 raise "Cannot remove first node (nodes_stack.count: #{nodes_stack.count})" end private def nodes_stack @nodes_stack ||= [::EacRubyUtils::Console::Speaker::Node.new] end end end end end
Version data entries
156 entries across 156 versions & 3 rubygems