Sha256: 1a27deeed6bfcc0ac9276463703d4ada5c9b378f7cc5629e8760f0f20eec6a6a

Contents?: true

Size: 719 Bytes

Versions: 15

Compression:

Stored size: 719 Bytes

Contents

# Similar to ActiveSupport.class_attribute but with a setter that doesn't use the #{name}= syntax
# This preserves backward compatibility with the API in ActiveTriples

module ActiveFedora
  module InheritableAccessors
    extend ActiveSupport::Concern
    module ClassMethods
      def define_inheritable_accessor(*names)
        names.each do |name|
          define_accessor(name, nil)
        end
      end

      private
        def define_accessor(name, val)
          singleton_class.class_eval do
            remove_possible_method(name)
            define_method(name) do |uri = nil|
              define_accessor(name, uri) if uri
              val
            end
          end
        end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
active-fedora-9.0.8 lib/active_fedora/inheritable_accessors.rb
active-fedora-9.5.0 lib/active_fedora/inheritable_accessors.rb
active-fedora-9.4.3 lib/active_fedora/inheritable_accessors.rb
active-fedora-9.4.2 lib/active_fedora/inheritable_accessors.rb
active-fedora-9.4.1 lib/active_fedora/inheritable_accessors.rb
active-fedora-9.4.0 lib/active_fedora/inheritable_accessors.rb
active-fedora-9.3.0 lib/active_fedora/inheritable_accessors.rb
active-fedora-9.2.1 lib/active_fedora/inheritable_accessors.rb
active-fedora-9.2.0 lib/active_fedora/inheritable_accessors.rb
active-fedora-9.2.0.rc2 lib/active_fedora/inheritable_accessors.rb
active-fedora-9.2.0.rc1 lib/active_fedora/inheritable_accessors.rb
active-fedora-9.1.2 lib/active_fedora/inheritable_accessors.rb
active-fedora-9.1.1 lib/active_fedora/inheritable_accessors.rb
active-fedora-9.1.0 lib/active_fedora/inheritable_accessors.rb
active-fedora-9.1.0.rc1 lib/active_fedora/inheritable_accessors.rb