Skip to content

Multiple calls to attributes shouldn't result in multiple definitions of methods for accessors, equality, etc. #2

Description

@louismrose

The following example:

class Person
  extend Attributable
  attributes :name
end

class Employee < Person
  attributes :salary
end

Defining Employee results in two calls to Attributable#add_instance_methods and hence Attributable's define_method logic is called twice (once with attributes = {name: nil} and once with attributes = {name: nil, salary: nil}).

It seems redundant to add these methods more than once.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions