<commit_before>require 'rails'

module SeoMeta

  class << self
    def attributes
      @@attributes ||= {
        :browser_title => :string,
        :meta_keywords => :string,
        :meta_description => :text
      }
    end
  end

  class Engine < ::Rails::Engine

  end

  autoload :InstanceMethods, File.expand_path('../seo_meta/instance_methods', __FILE__)

end

def is_seo_meta(options = {})
  if ::SeoMetum.table_exists?
    # Let the base know about SeoMetum
    has_one :seo_meta, :class_name => 'SeoMetum',
            :foreign_key => :seo_meta_id, :dependent => :destroy,
            :conditions => {:seo_meta_type => self.name}

    # Let SeoMetum know about the base
    ::SeoMetum.send :belongs_to, self.name.underscore.gsub('/', '_').to_sym,
                    :class_name => self.name

    # Include the instance methods.
    self.send :include, ::SeoMeta::InstanceMethods

    # Ensure that seo_meta is saved after the model is saved.
    after_save :save_meta_tags!

    # Delegate both the accessor and setters for the fields to :seo_meta
    fields = ::SeoMeta.attributes.keys.reject{|field|
      self.column_names.map(&:to_sym).include?(field)
    }.map{|a| [a, :"#{a}="]}.flatten
    fields << {:to => :seo_meta}

    delegate *fields
  end
end<commit_msg>Rather than introducing stack level too deep errors when we call is_seo_meta twice, we now can't.<commit_after>require 'rails'

module SeoMeta

  class << self
    def attributes
      @@attributes ||= {
        :browser_title => :string,
        :meta_keywords => :string,
        :meta_description => :text
      }
    end
  end

  class Engine < ::Rails::Engine

  end

  autoload :InstanceMethods, File.expand_path('../seo_meta/instance_methods', __FILE__)

end

def is_seo_meta(options = {})
  if included_modules.exclude?(::SeoMeta::InstanceMethods)
    # Let the base know about SeoMetum
    has_one :seo_meta, :class_name => 'SeoMetum',
            :foreign_key => :seo_meta_id, :dependent => :destroy,
            :conditions => {:seo_meta_type => self.name}

    # Let SeoMetum know about the base
    ::SeoMetum.send :belongs_to, self.name.underscore.gsub('/', '_').to_sym,
                    :class_name => self.name

    # Include the instance methods.
    self.send :include, ::SeoMeta::InstanceMethods

    # Ensure that seo_meta is saved after the model is saved.
    after_save :save_meta_tags!
  end

  # Delegate both the accessor and setters for the fields to :seo_meta
  fields = ::SeoMeta.attributes.keys
  fields = fields.reject{|field|
    self.column_names.map(&:to_sym).include?(field)
  } if self.table_exists?
  fields = fields.map{|a| [a, :"#{a}="]}.flatten

  fields << {:to => :seo_meta}
  delegate *fields
end
{'fraction_non_alphanumeric': 0.12513761467889908, 'fraction_numerical': 0.0, 'mean_word_length': 3.117824773413897, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 23, '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': '1724955', 'n_tokens_mistral': 931, 'n_tokens_neox': 893, 'n_words': 223}