<commit_before>﻿#region --- License & Copyright Notice ---
/*
ConsoleFx CLI Library Suite
Copyright 2015-2019 <NAME>

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#endregion

namespace ConsoleFx.Prompter
{
    public abstract class PromptItem
    {
        /// <summary>
        ///     Initializes a new instance of the <see cref="PromptItem"/> class.
        /// </summary>
        /// <param name="message">The <paramref name="message"/> to display to the user.</param>
        protected PromptItem(FunctionOrValue<string> message)
        {
            Message = message;
        }

        public PromptItem When(AnswersFunc<bool> canAskFn)
        {
            CanAskFn = canAskFn;
            return this;
        }

        internal FunctionOrValue<string> Message { get; }

        internal AnswersFunc<bool> CanAskFn { get; set; }

        internal abstract AskerFn AskerFn { get; }

        internal bool CanAsk(dynamic answers) =>
            (CanAskFn is null) || (bool)CanAskFn(answers);
    }
}<commit_msg>Code cleanup<commit_after>﻿#region --- License & Copyright Notice ---
/*
ConsoleFx CLI Library Suite
Copyright 2015-2019 <NAME>

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#endregion

namespace ConsoleFx.Prompter
{
    /// <summary>
    ///     Base class for any item that can be displayed by the prompter.
    ///     <para/>
    ///     This includes questions (<see cref="Question"/>) and static text (<see cref="StaticText"/>).
    /// </summary>
    public abstract class PromptItem
    {
        /// <summary>
        ///     Initializes a new instance of the <see cref="PromptItem"/> class.
        /// </summary>
        /// <param name="message">The <paramref name="message"/> to display to the user.</param>
        protected PromptItem(FunctionOrValue<string> message)
        {
            Message = message;
        }

        public PromptItem When(AnswersFunc<bool> canAskFn)
        {
            CanAskFn = canAskFn;
            return this;
        }

        internal FunctionOrValue<string> Message { get; }

        internal AnswersFunc<bool> CanAskFn { get; set; }

        internal abstract AskerFn AskerFn { get; }

        internal bool CanAsk(dynamic answers)
        {
            return (CanAskFn is null) || (bool)CanAskFn(answers);
        }
    }
}
{'fraction_non_alphanumeric': 0.09332925336597307, 'fraction_numerical': 0.0073439412484700125, 'mean_word_length': 2.572677595628415, 'pattern_counts': {'":': 0, '<': 30, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6509318', 'n_tokens_mistral': 909, 'n_tokens_neox': 849, 'n_words': 329}