Sha256: b5a4a88430905dca59429b75f8fb172451bf498876da2715b3b727a93ba1706c
Contents?: true
Size: 630 Bytes
Versions: 8
Compression:
Stored size: 630 Bytes
Contents
# encoding: utf-8 require_relative 'result' module TTY class Prompt # Evaluates provided parameters and stops if any of them fails # @api private class Evaluator attr_reader :results def initialize(question, &block) @question = question @results = [] instance_eval(&block) if block end def call(initial) seed = Result::Success.new(@question, initial) results.reduce(seed, &:with) end def check(proc = nil, &block) results << (proc || block) end alias_method :<<, :check end # Evaluator end # Prompt end # TTY
Version data entries
8 entries across 8 versions & 2 rubygems