<commit_before>module Hydra
  module Datastream
      class RightsMetadata < ActiveFedora::NokogiriDatastream
        extend_terminology do |t|
          t.root(:path=>"rightsMetadata", :xmlns=>"http://hydra-collab.stanford.edu/schemas/rightsMetadata/v1", :schema=>"http://github.com/projecthydra/schemas/tree/v1/rightsMetadata.xsd")
          t.exceptions_access(:ref=>[:access], :attributes=>{:type=>"exceptions"})
        end

        # @param [Symbol] type (either :group or :person)
        # @return 
        # This method limits the response to known access levels.  Probably runs a bit faster than .permissions().
        def quick_search_by_type(type)
          result = {}
          [{:discover_access=>"discover"},{:read_access=>"read"},{:edit_access=>"edit"},{:exceptions_access=>"exceptions"}].each do |access_levels_hash|
            access_level = access_levels_hash.keys.first
            access_level_name = access_levels_hash.values.first
            self.find_by_terms(*[access_level, type]).each do |entry|
              result[entry.text] = access_level_name
            end
          end
        return result
        end
      end
  end
end<commit_msg>Change RightsMetadata ancestor to OmDatastream<commit_after>module Hydra
  module Datastream
      class RightsMetadata < ActiveFedora::OmDatastream
        extend_terminology do |t|
          t.root(:path=>"rightsMetadata", :xmlns=>"http://hydra-collab.stanford.edu/schemas/rightsMetadata/v1", :schema=>"http://github.com/projecthydra/schemas/tree/v1/rightsMetadata.xsd")
          t.exceptions_access(:ref=>[:access], :attributes=>{:type=>"exceptions"})
        end

        # @param [Symbol] type (either :group or :person)
        # @return 
        # This method limits the response to known access levels.  Probably runs a bit faster than .permissions().
        def quick_search_by_type(type)
          result = {}
          [{:discover_access=>"discover"},{:read_access=>"read"},{:edit_access=>"edit"},{:exceptions_access=>"exceptions"}].each do |access_levels_hash|
            access_level = access_levels_hash.keys.first
            access_level_name = access_levels_hash.values.first
            self.find_by_terms(*[access_level, type]).each do |entry|
              result[entry.text] = access_level_name
            end
          end
        return result
        end
      end
  end
end
{'fraction_non_alphanumeric': 0.12116112747160286, 'fraction_numerical': 0.0016827934371055953, 'mean_word_length': 2.969949916527546, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '2218153', 'n_tokens_mistral': 725, 'n_tokens_neox': 687, 'n_words': 131}