Skip to content

Files

Latest commit

 

History

History
29 lines (21 loc) · 477 Bytes

Style-DataInheritance.md

File metadata and controls

29 lines (21 loc) · 477 Bytes

Pattern: Inheritance from Data.define

Issue: -

Description

Checks for inheritance from Data.define to avoid creating the anonymous parent class.

Examples

# bad
class Person < Data.define(:first_name, :last_name)
  def age
    42
  end
end

# good
Person = Data.define(:first_name, :last_name) do
  def age
    42
  end
end

Further Reading