Module: Dry

Defined in:
lib/dry-stack/stack.rb,
lib/version.rb,
lib/dry-stack/command_line.rb

Overview

class TrueClass

def encode_with(coder) = coder.represent_scalar('tag:yaml.org,2002:str', 'true')

end

class FalseClass

def encode_with(coder)= coder.represent_scalar('tag:yaml.org,2002:str', 'false')

end

Defined Under Namespace

Modules: CommandLine Classes: ServiceFunction, Stack, SwarmFunction

Instance Method Summary collapse

Instance Method Details

#each_recursive(parent, each_ = -> { _1.respond_to?(:each) ? _1.each : [] }, path = [], &blk) ⇒ Object



33
34
35
36
37
38
39
# File 'lib/dry-stack/stack.rb', line 33

def each_recursive(parent, each_ =-> { _1.respond_to?(:each) ? _1.each : [] }, path = [], &blk)
  each2_ = each_.is_a?(Array) ? ->(p) { (m = each_.find { p.respond_to? _1 }) ? p.send(m) : [] } : each_
  (each2_[parent] || []).each do |(k,v)|
    blk.call [path + [parent], k, v, path]
    each_recursive(v || k, each_, path + [parent], &blk)
  end
end

#Stack(name = nil) ⇒ Object



41
42
43
44
# File 'lib/dry-stack/stack.rb', line 41

def Stack(name = nil, &)
  Stack.last_stack = Stack.new name
  Stack.last_stack.instance_exec(&) if block_given?
end