# File ../../../../../lib/review/compiler.rb, line 52 def initialize(name, type, argc, &block) @name = name @type = type @argc_spec = argc @checker = block end
# File ../../../../../lib/review/compiler.rb, line 79 def block_allowed? @type == :block or @type == :optional end
# File ../../../../../lib/review/compiler.rb, line 75 def block_required? @type == :block end
# File ../../../../../lib/review/compiler.rb, line 61 def check_args(args) raise CompileError, "wrong # of parameters (block command //#{@name}, expect #{@argc_spec} but #{args.size})" unless @argc_spec === args.size @checker.call(*args) if @checker end
# File ../../../../../lib/review/compiler.rb, line 66 def min_argc case @argc_spec when Range then @argc_spec.begin when Integer then @argc_spec else raise TypeError, "argc_spec is not Range/Integer: #{inspect}" end end