<commit_before>module Propeller
  module Configuration
    class Section
      attr_accessor :name
      attr_accessor :options

      def initialize(section_hash)
        @name    = section_hash[:section]
        @options = section_hash[:options]
        @if      = section_hash[:if]
      end

      def is_visible?(settings)
        return true if @if.nil?

        exists = settings.index do |setting|
          if @if == setting.option.name
            case setting.option.type
            when :bool
              setting.value == true
            when :integer, :decimal
              setting.value > 0
            when :string
              setting.value.length > 0
            end
          end
        end

        not exists.nil?
      end
    end
  end
end
<commit_msg>Adds option queries to Section.<commit_after>module Propeller
  module Configuration
    class Section
      attr_accessor :name
      attr_accessor :options

      def initialize(section_hash)
        @name    = section_hash[:section]
        @options = section_hash[:options]
        @if      = section_hash[:if]
      end

      def contains_option?(name)
        @options.select{|o| o.name == name}.length > 0
      end

      def option(name)
        result = @options.select do |option|
          option.name == name
        end

        result.first
      end

      def is_visible?(settings)
        return true if @if.nil?

        exists = settings.index do |setting|
          if @if == setting.option.name
            case setting.option.type
            when :bool
              setting.value == true
            when :integer, :decimal
              setting.value > 0
            when :string
              setting.value.length > 0
            end
          end
        end

        not exists.nil?
      end
    end
  end
end

{'fraction_non_alphanumeric': 0.07354555433589462, 'fraction_numerical': 0.0027442371020856204, 'mean_word_length': 1.5006858710562414, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '6525277', 'n_tokens_mistral': 492, 'n_tokens_neox': 477, 'n_words': 134}