<commit_before>module Dill
  class Widget
    extend Forwardable

    include WidgetContainer

    # @!group Widget macros

      # Defines a new action.
      #
      # This is a shortcut to help defining a widget and a method that clicks
      # on that widget. You can then send a widget instance the message given
      # by +name+.
      #
      # @example
      #   # Consider the widget will encapsulate the following HTML
      #   #
      #   # <div id="profile">
      #   #  <a href="/profiles/1/edit" rel="edit">Edit</a>
      #   # </div>
      #   class PirateProfile < Dill::Widget
      #     root "#profile"
      #
      #     # Declare the action
      #     action :edit, '[rel = edit]'
      #   end
      #
      #   # Click the link
      #   widget(:pirate_profile).edit
      #
      # @param name the name of the action
      # @param selector the selector for the widget that will be clicked
      def self.action(name, selector)
        widget name, selector

        define_method name do
          widget(name).click

          self
        end
      end

      # Declares a new child widget.
      #
      # Child widgets are accessible inside the container widget using the
      # +widget+ message.
      #
      # @param name the name of the child widget
      # @param selector the child widget selector
      # @param parent [Class] the parent class of the new child widget
      #<commit_msg>[widget] Tweak documentation.<commit_after>module Dill
  class Widget
    extend Forwardable

    include WidgetContainer

    # @!group Widget macros

      # Defines a new action.
      #
      # This is a shortcut to help defining a widget and a method that clicks
      # on that widget. You can then send a widget instance the message given
      # by +name+.
      #
      # @example
      #   # Consider the widget will encapsulate the following HTML
      #   #
      #   # <div id="profile">
      #   #  <a href="/profiles/1/edit" rel="edit">Edit</a>
      #   # </div>
      #   class PirateProfile < Dill::Widget
      #     root "#profile"
      #
      #     # Declare the action
      #     action :edit, '[rel = edit]'
      #   end
      #
      #   # Click the link
      #   widget(:pirate_profile).edit
      #
      # @param name the name of the action
      # @param selector the selector for the widget that will be clicked
      def self.action(name, selector)
        widget name, selector

        define_method name do
          widget(name).click

          self
        end
      end

      # Declares a new child widget.
      #
      # Child widgets are accessible inside the container widget using the
      # {#widget} message. They are automatically scoped to the parent widget's
      # root node.
      #
      # @param name the name of the child widget.
      # @param selector the child widget selector.
      # @param parent [Class] the parent class of the new child widget.
      #
{'fraction_non_alphanumeric': 0.07796610169491526, 'fraction_numerical': 0.0006779661016949153, 'mean_word_length': 1.8293384467881113, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 11, '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': '4357492', 'n_tokens_mistral': 815, 'n_tokens_neox': 789, 'n_words': 310}