<commit_before># frozen_string_literal: true

# Formula info drawn from an external `brew info --json` call

class FormulaInfo
  # The whole info structure parsed from the JSON
  attr_accessor :info

  def initialize(info)
    @info = info
  end

  # Looks up formula on disk and reads its info.
  # Returns nil if formula is absent or if there was an error reading it.
  def self.lookup(name)
    json = Utils.popen_read(
      RUBY_PATH,
      ENV["HOMEBREW_RUBY_WARNINGS"],
      "-I", $LOAD_PATH.join(File::PATH_SEPARATOR),<commit_msg>Document `FormulaInfo`.<commit_after># frozen_string_literal: true

# Formula information drawn from an external `brew info --json` call.
#
# @api private
class FormulaInfo
  # The whole info structure parsed from the JSON
  attr_accessor :info

  def initialize(info)
    @info = info
  end

  # Looks up formula on disk and reads its info.
  # Returns nil if formula is absent or if there was an error reading it.
  def self.lookup(name)
    json = Utils.popen_read(
      RUBY_PATH,
      ENV["HOMEBREW_RUBY_WARNINGS"],
      "-I", $LOAD_PATH.join(File::PATH_SEPARATOR),
{'fraction_non_alphanumeric': 0.08363309352517985, 'fraction_numerical': 0.0, 'mean_word_length': 3.580246913580247, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '7226229', 'n_tokens_mistral': 355, 'n_tokens_neox': 342, 'n_words': 124}