Sha256: 5282a5a83f4c0f56257cef6906beb23915b9c645b3d9bc626bc8f2013899748c
Contents?: true
Size: 937 Bytes
Versions: 13
Compression:
Stored size: 937 Bytes
Contents
module ShellOpts module Ast class Command < Node # Array of options (Ast::Option). Initially empty but filled out by the # parser attr_reader :options # Optional sub-command (Ast::Command). Initially nil but assigned by the # parser attr_accessor :command def initialize(grammar, name) super(grammar, name) @options = [] @command = nil end # Array of option or command tuples def values (options + (Array(command || []))).map { |node| node.to_tuple } end # :nocov: def dump(&block) super { yield if block_given? puts "options:" indent { options.each { |opt| opt.dump } } print "command:" if command puts indent { command.dump } else puts "nil" end } end # :nocov: end end end
Version data entries
13 entries across 13 versions & 1 rubygems