Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support singleton class definition #166

Merged
merged 3 commits into from
Jul 17, 2020
Merged

Support singleton class definition #166

merged 3 commits into from
Jul 17, 2020

Conversation

soutaro
Copy link
Owner

@soutaro soutaro commented Jul 16, 2020

  • Singleton class support in a class definition
  • Singleton class support for an instance (but what should we do for this???)
# Singleton class definition in a class definition

class WithSingleton
  class <<self
    def open
      yield new()
    end
  end
end

# Singleton class definition for an instance

x = Object.new
class <<x
  def foo
    "foo!"
  end
end

@soutaro soutaro marked this pull request as ready for review July 17, 2020 03:20
@soutaro soutaro merged commit e0daba2 into master Jul 17, 2020
@soutaro soutaro deleted the sclass branch July 17, 2020 03:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant