Skip to content

Methods defined in a Struct.new block end up on parent module #84

Description

@wagenet
Customer = Struct.new(:name, :address) do
  def greeting
    "Hello #{name}!"
  end
end

Generated:

class Object
  private
  def greeting: -> String
end

class Customer < Struct[untyped]
  attr_accessor name(): untyped
  attr_accessor address(): untyped
end

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

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions