<commit_before>require 'cascading_properties'

class CascadingProperties::Node < CascadingProperties::BlankSlate

  def initialize
    @_hash = {}
  end

  def method_missing(name, *args, &block)
    name = name.to_s
    case args.length
    when 0 then
      if block
        node = CascadingProperties::Node.new
        node.instance_eval(&block)
        @_hash[name] = node
        node
      else
        @_hash[name] ||= CascadingProperties::Node.new
      end
    when 1 then
      @_hash[name] = args.first
    else
      @_hash[name] = args
    end
  end

end<commit_msg>refactoring: remove 'if' statement by using invoking 'new' with block<commit_after>require 'cascading_properties'

class CascadingProperties::Node < CascadingProperties::BlankSlate

  def initialize(&block)
    @_hash = {}
    instance_eval(&block) if block
  end

  def method_missing(name, *args, &block)
    name = name.to_s
    case args.length
    when 0 then
      @_hash[name] ||= CascadingProperties::Node.new(&block)
    when 1 then
      @_hash[name] = args.first
    else
      @_hash[name] = args
    end
  end

end
{'fraction_non_alphanumeric': 0.09764918625678119, 'fraction_numerical': 0.003616636528028933, 'mean_word_length': 2.8842105263157896, 'pattern_counts': {'":': 0, '<': 5, '<?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': '2864709', 'n_tokens_mistral': 369, 'n_tokens_neox': 359, 'n_words': 87}