Sha256: 686a84cf496ebd0b55b059a3047b768f7075bdcd040c1d594b065e288f0201bd

Contents?: true

Size: 758 Bytes

Versions: 9

Compression:

Stored size: 758 Bytes

Contents

module ActiveFedora
  class ContentModel < Base
    CMODEL_NAMESPACE = "afmodel"
    CMODEL_PID_SUFFIX = ""
    
    attr_accessor :pid_suffix, :namespace
    
    def initialize(attrs={})
      @pid_suffix = attrs.has_key?(:pid_suffix) ? attrs[:pid_suffix] : CMODEL_PID_SUFFIX
      @namespace = attrs.has_key?(:namespace) ? attrs[:namespace] : CMODEL_NAMESPACE
      super
    end
    
    def self.pid_from_ruby_class(klass,attrs={})
      sanitized_class_name = klass.name.gsub(/(::)/, '_')
      pid_suffix = attrs.has_key?(:pid_suffix) ? attrs[:pid_suffix] : CMODEL_PID_SUFFIX
      namespace = attrs.has_key?(:namespace) ? attrs[:namespace] : CMODEL_NAMESPACE   
      return "#{namespace}:#{sanitized_class_name}#{pid_suffix}" 
    end
    
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
active-fedora-1.1.2 lib/active_fedora/content_model.rb
active-fedora-1.1.1 lib/active_fedora/content_model.rb
active-fedora-1.1.0 lib/active_fedora/content_model.rb
active-fedora-1.0.4 lib/active_fedora/content_model.rb
active-fedora-1.0.5 lib/active_fedora/content_model.rb
active-fedora-1.0.0 lib/active_fedora/content_model.rb
active-fedora-1.0.1 lib/active_fedora/content_model.rb
active-fedora-1.0.2 lib/active_fedora/content_model.rb
ruby-fedora-0.9.0 lib/active_fedora/content_model.rb