Sha256: 7647f655dafb99a27a8ddb6f7356b96f02f8a28d91efbfb9c1cb9142de721f2f

Contents?: true

Size: 720 Bytes

Versions: 65

Compression:

Stored size: 720 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

65 entries across 65 versions & 1 rubygems

Version Path
active-fedora-11.5.6 lib/active_fedora/inheritable_accessors.rb
active-fedora-11.2.1 lib/active_fedora/inheritable_accessors.rb
active-fedora-12.0.3 lib/active_fedora/inheritable_accessors.rb
active-fedora-11.5.5 lib/active_fedora/inheritable_accessors.rb
active-fedora-11.5.4 lib/active_fedora/inheritable_accessors.rb
active-fedora-11.5.3 lib/active_fedora/inheritable_accessors.rb
active-fedora-12.0.2 lib/active_fedora/inheritable_accessors.rb
active-fedora-12.0.1 lib/active_fedora/inheritable_accessors.rb
active-fedora-11.5.2 lib/active_fedora/inheritable_accessors.rb
active-fedora-12.0.0 lib/active_fedora/inheritable_accessors.rb
active-fedora-11.5.0 lib/active_fedora/inheritable_accessors.rb
active-fedora-11.4.1 lib/active_fedora/inheritable_accessors.rb
active-fedora-11.4.0 lib/active_fedora/inheritable_accessors.rb
active-fedora-11.3.1 lib/active_fedora/inheritable_accessors.rb
active-fedora-11.3.0 lib/active_fedora/inheritable_accessors.rb
active-fedora-11.2.0 lib/active_fedora/inheritable_accessors.rb
active-fedora-11.1.6 lib/active_fedora/inheritable_accessors.rb
active-fedora-11.1.5 lib/active_fedora/inheritable_accessors.rb
active-fedora-11.1.4 lib/active_fedora/inheritable_accessors.rb
active-fedora-11.1.3 lib/active_fedora/inheritable_accessors.rb