<commit_before>module MsfModels::ActiveRecordModels::Note
  def self.included(base)
    base.class_eval{
      include Msf::DBManager::DBSave

      belongs_to :workspace, :class_name => "Msm::Workspace"
      belongs_to :host, :class_name => "Msm::Host"
      belongs_to :service, :class_name => "Msm::Service"
      serialize :data, ::MsfModels::Base64Serializer.new

      scope :flagged, where('critical = true AND seen = false')
      scope :visible, where(['ntype NOT IN (?)', ['web.form', 'web.url', 'web.vuln']])

      def after_save
        if data_changed? and ntype =~ /fingerprint/
          host.normalize_os
        end
      end
    }
  end
end
<commit_msg>Msm::Note - changed callback to use rails 3 syntax<commit_after>module MsfModels::ActiveRecordModels::Note
  def self.included(base)
    base.class_eval{
      include Msf::DBManager::DBSave

      belongs_to :workspace, :class_name => "Msm::Workspace"
      belongs_to :host, :class_name => "Msm::Host"
      belongs_to :service, :class_name => "Msm::Service"
      serialize :data, ::MsfModels::Base64Serializer.new

      scope :flagged, where('critical = true AND seen = false')
      scope :visible, where(['ntype NOT IN (?)', ['web.form', 'web.url', 'web.vuln']])

      after_save :normalize

      private

      def normalize
        if data_changed? and ntype =~ /fingerprint/
          host.normalize_os
        end
      end
    }
  end
end

{'fraction_non_alphanumeric': 0.12903225806451613, 'fraction_numerical': 0.0035063113604488078, 'mean_word_length': 3.0888252148997135, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '3095963', 'n_tokens_mistral': 472, 'n_tokens_neox': 460, 'n_words': 108}