Skip to content

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

@louismrose

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.

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