Methods

Class Public methods

batch(owner, path, line)

📝 Source code
# File activemodel/lib/active_model/attribute_methods.rb, line 340
            def batch(owner, path, line)
              if owner.is_a?(CodeGenerator)
                yield owner
              else
                instance = new(owner, path, line)
                result = yield instance
                instance.execute
                result
              end
            end
🔎 See on GitHub

new(owner, path, line)

📝 Source code
# File activemodel/lib/active_model/attribute_methods.rb, line 352
          def initialize(owner, path, line)
            @owner = owner
            @path = path
            @line = line
            @sources = ["# frozen_string_literal: true\n"]
            @renames = {}
          end
🔎 See on GitHub

Instance Public methods

<<(source_line)

📝 Source code
# File activemodel/lib/active_model/attribute_methods.rb, line 360
          def <<(source_line)
            @sources << source_line
          end
🔎 See on GitHub

execute()

📝 Source code
# File activemodel/lib/active_model/attribute_methods.rb, line 368
          def execute
            @owner.module_eval(@sources.join(";"), @path, @line - 1)
            @renames.each do |old_name, new_name|
              @owner.alias_method new_name, old_name
              @owner.undef_method old_name
            end
          end
🔎 See on GitHub

rename_method(old_name, new_name)

📝 Source code
# File activemodel/lib/active_model/attribute_methods.rb, line 364
          def rename_method(old_name, new_name)
            @renames[old_name] = new_name
          end
🔎 See on GitHub