class ActiveSupport::CurrentAttributes

def attribute(*names)

Declares one or more attributes that will be given both class and instance accessor methods.
def attribute(*names)
  ActiveSupport::CodeGenerator.batch(generated_attribute_methods, __FILE__, __LINE__) do |owner|
    names.each do |name|
      owner.define_cached_method(name, namespace: :current_attributes) do |batch|
        batch <<
          "def #{name}" <<
          "attributes[:#{name}]" <<
          "end"
      end
      owner.define_cached_method("#{name}=", namespace: :current_attributes) do |batch|
        batch <<
          "def #{name}=(value)" <<
          "attributes[:#{name}] = value" <<
          "end"
      end
    end
  end
  ActiveSupport::CodeGenerator.batch(singleton_class, __FILE__, __LINE__) do |owner|
    names.each do |name|
      owner.define_cached_method(name, namespace: :current_attributes_delegation) do |batch|
        batch <<
          "def #{name}" <<
          "instance.#{name}" <<
          "end"
      end
      owner.define_cached_method("#{name}=", namespace: :current_attributes_delegation) do |batch|
        batch <<
          "def #{name}=(value)" <<
          "instance.#{name} = value" <<
          "end"
      end
    end
  end
end