module ActiveFedora::AttributeMethods::Write::ClassMethods
Protected Instance Methods
define_method_attribute=(canonical_name, owner: nil, as: canonical_name)
click to toggle source
# File lib/active_fedora/attribute_methods/write.rb, line 7 def define_method_attribute=(canonical_name, owner: nil, as: canonical_name) ActiveModel::AttributeMethods::AttrNames.define_attribute_accessor_method( owner, canonical_name, writer: true ) do |temp_method_name, attr_name_expr| # rubocop:disable Style/LineEndConcatenation if ActiveModel.version >= Gem::Version.new('7.0.0') owner.define_cached_method(temp_method_name, as: "#{as}=", namespace: :active_fedora) do |batch| batch << "def #{temp_method_name}(value)" << " write_attribute(#{attr_name_expr}, value)" << "end" end else owner << "def #{temp_method_name}(value)" << " write_attribute(#{attr_name_expr}, value)" << "end" end # rubocop:enable Style/LineEndConcatenation end end