lib/cliutils/prefs/pref.rb in cliutils-1.4.1 vs lib/cliutils/prefs/pref.rb in cliutils-1.4.2

- old
+ new

@@ -61,10 +61,12 @@ # Initializes a new Pref via passed-in parameters. # @param [Hash] params Parameters to initialize # @return [void] def initialize(params = {}) params.each { |key, value| send("#{ key }=", value) } + + # _load_validators if @validators end # Custom equality operator for this class. # @param [Pref] other # @return [Boolean] @@ -82,19 +84,19 @@ def deliver(default = nil) # Design decision: the pre-prompt behavior # gets evaluated *once*, not every time the # user gets prompted. This prevents multiple # evaluations when bad options are provided. - _eval_pre + _eval_pre if @pre valid_option_chosen = false until valid_option_chosen response = prompt(@prompt_text, default) if validate(response) valid_option_chosen = true @answer = evaluate_behaviors(response) - _eval_post + _eval_post if @post else messenger.error(@last_error_message) end end end @@ -223,8 +225,12 @@ require action_path Object.const_get("CLIUtils::#{ action_name }Action").new rescue messenger.warn("Skipping undefined Pref Action: #{ path_or_name }") end + end + + def _load_validators + end end end