<commit_before>module SKUI

  require File.join( PATH, 'control.rb' )


  # @since 1.0.0
  class Listbox < Control

    # @since 1.0.0
    prop_reader( :items, :multiple, :size )

    # @since 1.0.0
    define_event( :change )
    
    # @param [Array<String>] list
    # @param [Proc] on_click
    #
    # @since 1.0.0
    def initialize( list )
      super()
       # (?) Should the :items list be a Hash instead? To allow key/value pairs.
      @properties[ :items ] = ( list.is_a?(Array) ) ? list : []
      @properties[ :multiple ] = false
    end

    # @overload add_item(string)
    #   @param [String] string
    #
    # @overload add_item(string, ...)
    #   @param [String] string
    #
    # @return [String]
    # @since 1.0.0
    def add_item( *args )
      args = args[0] if args.size == 1 && args[0].is_a?( Array )
      if args.size == 1
        @properties[ :items ] << args[0]
        window.bridge.call( 'UI.add_list_item', ui_id, args[0] )
      else
        @properties[ :items ].concat( args )
        window.bridge.call( 'UI.add_list_item', ui_id, args )
      end
    end

    # @return [String]
    # @since 1.0.0
    def value
      value = window.bridge.get_element_value( ui_id )
    end
    
    # @param [String] string<commit_msg>Made Listbox check that given argument is an Array.<commit_after>module SKUI

  require File.join( PATH, 'control.rb' )


  # @since 1.0.0
  class Listbox < Control

    # @since 1.0.0
    prop_reader( :items, :multiple, :size )

    # @since 1.0.0
    define_event( :change )
    
    # @param [Array<String>] list
    # @param [Proc] on_click
    #
    # @since 1.0.0
    def initialize( list = [] )
      unless list.is_a?( Array )
        raise( ArgumentError, 'Not an array.' )
      end
      # (?) Check for String content? Convert to strings? Accept #to_a objects?
      super()
       # (?) Should the :items list be a Hash instead? To allow key/value pairs.
      @properties[ :items ] = list
      @properties[ :multiple ] = false
    end

    # @overload add_item(string)
    #   @param [String] string
    #
    # @overload add_item(string, ...)
    #   @param [String] string
    #
    # @return [String]
    # @since 1.0.0
    def add_item( *args )
      args = args[0] if args.size == 1 && args[0].is_a?( Array )
      if args.size == 1
        @properties[ :items ] << args[0]
        window.bridge.call( 'UI.add_list_item', ui_id, args[0] )
      else
        @properties[ :items ].concat( args )
        window.bridge.call( 'UI.add_list_item', ui_id, args )
      end
    end

    # @return [String]
    # @since 1.0.0
    def value
      value = window.bridge.get_element_value( ui_id )
    end
    
    # @param [String] string
{'fraction_non_alphanumeric': 0.1386942087790483, 'fraction_numerical': 0.01770564367392106, 'mean_word_length': 2.138888888888889, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 5, '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': '1262163', 'n_tokens_mistral': 970, 'n_tokens_neox': 936, 'n_words': 247}