<commit_before># encoding: utf-8

module Ramom
  class Schema < BasicObject
    class Definition

      DEFAULT_OPTIONS = {
        base:           {},
        virtual:        {},
        fk_constraints: FKConstraint::Set.new
      }.freeze

      def self.context(base_relations, fk_constraints, virtual = EMPTY_HASH)
        Builder::Context.new(base_relations, fk_constraints, virtual.dup)
      end

      def self.build(options, &block)
        new(Context.new(DEFAULT_OPTIONS.dup.merge(options), &block))
      end

      include Concord.new(:context)

      attr_reader :base_relations
      attr_reader :virtual_relations
      attr_reader :fk_constraints
      attr_reader :fk_attributes

      def initialize(context)
        super
        @base_relations    = context.base
        @virtual_relations = context.virtual
        @fk_constraints    = context.fk_constraints
        @fk_attributes     = fk_constraints.source_attributes
      end

      # TODO think about a better name (for the natural join strategy)
      def fk_mapping
        fk_attributes.each_with_object({}) { |(source_name, attrs), h|
          h[Inflecto.singularize(source_name.to_s).to_sym] = attrs
        }
      end
    end # Definition
  end # Schema
end # Ramom
<commit_msg>Nuke unused & outdated Schema::Definition.context<commit_after># encoding: utf-8

module Ramom
  class Schema < BasicObject
    class Definition

      DEFAULT_OPTIONS = {
        base:           {},
        virtual:        {},
        fk_constraints: FKConstraint::Set.new
      }.freeze

      def self.build(options, &block)
        new(Context.new(DEFAULT_OPTIONS.dup.merge(options), &block))
      end

      include Concord.new(:context)

      attr_reader :base_relations
      attr_reader :virtual_relations
      attr_reader :fk_constraints
      attr_reader :fk_attributes

      def initialize(context)
        super
        @base_relations    = context.base
        @virtual_relations = context.virtual
        @fk_constraints    = context.fk_constraints
        @fk_attributes     = fk_constraints.source_attributes
      end

      # TODO think about a better name (for the natural join strategy)
      def fk_mapping
        fk_attributes.each_with_object({}) { |(source_name, attrs), h|
          h[Inflecto.singularize(source_name.to_s).to_sym] = attrs
        }
      end
    end # Definition
  end # Schema
end # Ramom

{'fraction_non_alphanumeric': 0.08076602830974189, 'fraction_numerical': 0.0008326394671107411, 'mean_word_length': 2.432857142857143, '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': '1440007', 'n_tokens_mistral': 730, 'n_tokens_neox': 700, 'n_words': 152}