<commit_before>############################################################################
## 
## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 
## All rights reserved. 
## Contact: N<NAME> (<EMAIL>) 
## 
## This file is part of Testability Driver. 
## 
## If you have questions regarding the use of this file, please contact 
## Nokia at <EMAIL> . 
## 
## This library is free software; you can redistribute it and/or 
## modify it under the terms of the GNU Lesser General Public 
## License version 2.1 as published by the Free Software Foundation 
## and appearing in the file LICENSE.LGPL included in the packaging 
## of this file. 
## 
############################################################################

require "fileutils" unless defined?( ::FileUtils )

module MobyUtil

  class FileHelper

    # Function to verify that given folder exists
    # == params
    # path:: String containing path
    # == returns
    def self.folder_exist?( path )

      begin

        Dir.entries( path ).kind_of?( Array )

      rescue

        false

      end

    end

    # Function to load dynamically ruby module(s) from given path
    # == params
    # path:: String containing path
    # == returns
    def self.load_modules( *path )

      # deterimine caller methods working folder
      source_path = File.dirname( MobyUtil::KernelHelper.parse_caller( caller(3).first ).first )

      path.each{ | path |

        # expand path if given path is relative path
        path = File.join( source_path, path ) if is_relative_path? path

        # automatically load ruby implementation files if given path is folder
        path = File.join( path, '*.rb' ) if File.directory?( path ) <commit_msg>Changed to be compatible with Ruby 1.9.2 caller format.<commit_after>############################################################################
## 
## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 
## All rights reserved. 
## Contact: <NAME> (<EMAIL>) 
## 
## This file is part of Testability Driver. 
## 
## If you have questions regarding the use of this file, please contact 
## Nokia at <EMAIL> . 
## 
## This library is free software; you can redistribute it and/or 
## modify it under the terms of the GNU Lesser General Public 
## License version 2.1 as published by the Free Software Foundation 
## and appearing in the file LICENSE.LGPL included in the packaging 
## of this file. 
## 
############################################################################

require "fileutils" unless defined?( ::FileUtils )

module MobyUtil

  class FileHelper

    # Function to verify that given folder exists
    # == params
    # path:: String containing path
    # == returns
    def self.folder_exist?( path )

      begin

        Dir.entries( path ).kind_of?( Array )

      rescue

        false

      end

    end

    # Function to load dynamically ruby module(s) from given path
    # == params
    # path:: String containing path
    # == returns
    def self.load_modules( *path )

      # deterimine caller methods working folder
      source_path = File.dirname( MobyUtil::KernelHelper.parse_caller( caller(3).first ).first )
      
      # Compatiblity for Ruby 1.9.2 caller format
      if source_path == "." || source_path[0].to_s == "<" 
        source_path = File.dirname( MobyUtil::KernelHelper.parse_caller( caller(2).first ).first )      
      end
      
      path.each{ | path |

        # expand path if given path is relative path
        path = File.join( source_path, path ) if is_relative_path? path

        # automatically load ruby implementation files if given path is folder
        path = File.join( path, '*.rb' ) if File.directory?( path ) 
{'fraction_non_alphanumeric': 0.16738197424892703, 'fraction_numerical': 0.005901287553648069, 'mean_word_length': 3.129568106312292, 'pattern_counts': {'":': 0, '<': 10, '<?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': '6251510', 'n_tokens_mistral': 1018, 'n_tokens_neox': 960, 'n_words': 377}