<commit_before>require 'active_support/all'
require 'sexp_info/sexp_thing/sexp_thing'
class SexpInfo

  VERSION = "0.0.3"

  def initialize(sexp)
    @sexp = sexp
  end

  def type
    sexp[1][0][0]
  end

  def defined_methods
    defined(:def)
  end

  def defined_classes
    defined(:class)
  end

  def to_h
    Hash[children.map{|c| [c.name, c.to_h] }]
  end

  def defined_modules
    defined(:module)
  end


  def children
    defined_classes + defined_methods + defined_modules
  end

  def [](name)
    (children).find{|m| m == name }
  end

  private

  attr_reader :sexp
  def defined(type)
    sexp[1] ? sexp[1].find_all{|s| s[0] == type}.map{|c| "SexpThing::#{type.to_s.camelize}".constantize.new(c) } : []
  end

end
<commit_msg>bumped version<commit_after>require 'active_support/all'
require 'sexp_info/sexp_thing/sexp_thing'
class SexpInfo

  VERSION = "0.0.4"

  def initialize(sexp)
    @sexp = sexp
  end

  def type
    sexp[1][0][0]
  end

  def defined_methods
    defined(:def)
  end

  def defined_classes
    defined(:class)
  end

  def to_h
    Hash[children.map{|c| [c.name, c.to_h] }]
  end

  def defined_modules
    defined(:module)
  end


  def children
    defined_classes + defined_methods + defined_modules
  end

  def [](name)
    (children).find{|m| m == name }
  end

  private

  attr_reader :sexp
  def defined(type)
    sexp[1] ? sexp[1].find_all{|s| s[0] == type}.map{|c| "SexpThing::#{type.to_s.camelize}".constantize.new(c) } : []
  end

end

{'fraction_non_alphanumeric': 0.13279678068410464, 'fraction_numerical': 0.012072434607645875, 'mean_word_length': 3.191011235955056, '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': '2707900', 'n_tokens_mistral': 617, 'n_tokens_neox': 584, 'n_words': 119}