<commit_before>#
# Copyright (C) 2015-2017 <NAME>  <<EMAIL>>
#
# This source code is licensed under the GNU lesser general public license,
# Version 3.  See the file COPYING for more details

require_relative 'oo_structured_state'

module StateMachine

  module OOStructuredFSM

    # Handling variable state.
    class VariableState < OOStructuredState

      @language

      def initialize(pLanguage)
        @language = pLanguage
      end

      # @see OOStructuredState
      def handle_line(pLine)
        idle_capture
      end

      # @see OOStructuredState
      def idle_capture
        @language.set_state(@language.idleState)
      end

      # @see OOStructuredState
      def execute(pElementFile, pLine)
        variableList = @language.processed_line
        if variableList
          variableList.each do |variable|
            variable.comments = @language.string_comment_to_transfer
          end
          @language.string_comment_to_transfer = ''
          pElementFile.add_global_variable(variableList)
        end

        idle_capture
        return pElementFile
      end

    # End class
    end

  # End OOStructuredFSM
  end

# End StateMachine
end<commit_msg>Fixed rubocop errors on lib/kuniri/state_machine/OO_structured_fsm/variable_state.rb<commit_after>#
# Copyright (C) 2015-2017 <NAME>  <<EMAIL>>
#
# This source code is licensed under the GNU lesser general public license,
# Version 3.  See the file COPYING for more details

require_relative 'oo_structured_state'

module StateMachine

  module OOStructuredFSM

    # Handling variable state.
    class VariableState < OOStructuredState
      def initialize(pLanguage)
        @language = pLanguage
      end

      # @see OOStructuredState
      def handle_line(_pLine)
        idle_capture
      end

      # @see OOStructuredState
      def idle_capture
        @language.set_state(@language.idleState)
      end

      # @see OOStructuredState
      def execute(pElementFile, _pLine)
        variableList = @language.processed_line
        if variableList
          variableList.each do |variable|
            variable.comments = @language.string_comment_to_transfer
          end
          @language.string_comment_to_transfer = ''
          pElementFile.add_global_variable(variableList)
        end

        idle_capture
        return pElementFile
      end

    end # End clas
  end # End OOStructuredFSM
end # End StateMachine
{'fraction_non_alphanumeric': 0.05688375927452597, 'fraction_numerical': 0.00741962077493817, 'mean_word_length': 2.6062407132243686, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 9, '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': '7588037', 'n_tokens_mistral': 713, 'n_tokens_neox': 679, 'n_words': 178}