lib/browser_web_data_entity_sumarization/entity_sumarization_statistics.rb
###
# The method helps to load json file.
#
# @param [String] file_path
# @param [String] def_val If no exist file add values as default.
# @param [Hash] json_params JSON.parse params
#
# @return [Object] json
The method helps to load json file.
The method helps to load json file .
def ensure_load_json(file_path, def_val, json_params = {})
        if File.exists?(file_path)
          file_data = File.read(file_path).force_encoding('utf-8')
          if file_data.size >= 2 
            JSON.parse(file_data, json_params)
          else
            def_val
          end
        else
          def_val
        end
      end
def ensure_load_json ( file_path , def_val , json_params = { } ) if File . exists? ( file_path ) file_data = File . read ( file_path ) . force_encoding ( 'utf-8' ) if file_data . size >= 2 JSON . parse ( file_data , json_params ) else def_val end else def_val end end
The method helps to load json file.
The method helps to load json file .
# '[]'
None
Object
file_path
<not_specific>
def_val
<not_specific>
json_params
<not_specific>
<not_specific>
json_params JSON.parse params
json_params JSON . parse params