Sha256: f860de9eb4a2171455ff87c08bbcda6de9f7252f4c8df63185205475f9ffb848

Contents?: true

Size: 775 Bytes

Versions: 22

Compression:

Stored size: 775 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
require "active_support/core_ext/module/remove_method"

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

22 entries across 22 versions & 1 rubygems

Version Path
active-fedora-15.0.1 lib/active_fedora/inheritable_accessors.rb
active-fedora-15.0.0 lib/active_fedora/inheritable_accessors.rb
active-fedora-14.0.1 lib/active_fedora/inheritable_accessors.rb
active-fedora-14.0.0 lib/active_fedora/inheritable_accessors.rb
active-fedora-13.3.0 lib/active_fedora/inheritable_accessors.rb
active-fedora-12.2.4 lib/active_fedora/inheritable_accessors.rb
active-fedora-13.2.7 lib/active_fedora/inheritable_accessors.rb
active-fedora-13.2.5 lib/active_fedora/inheritable_accessors.rb
active-fedora-13.2.4 lib/active_fedora/inheritable_accessors.rb
active-fedora-12.2.3 lib/active_fedora/inheritable_accessors.rb
active-fedora-13.2.3 lib/active_fedora/inheritable_accessors.rb
active-fedora-13.2.2 lib/active_fedora/inheritable_accessors.rb
active-fedora-13.2.0 lib/active_fedora/inheritable_accessors.rb
active-fedora-13.1.3 lib/active_fedora/inheritable_accessors.rb
active-fedora-12.2.2 lib/active_fedora/inheritable_accessors.rb
active-fedora-12.2.1 lib/active_fedora/inheritable_accessors.rb
active-fedora-13.1.2 lib/active_fedora/inheritable_accessors.rb
active-fedora-13.1.1 lib/active_fedora/inheritable_accessors.rb
active-fedora-13.1.0 lib/active_fedora/inheritable_accessors.rb
active-fedora-13.0.0 lib/active_fedora/inheritable_accessors.rb