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

Ruby Instance Method and Class Method #9

Open
byhbt opened this issue Jul 14, 2020 · 0 comments
Open

Ruby Instance Method and Class Method #9

byhbt opened this issue Jul 14, 2020 · 0 comments
Labels
Ruby Learning Ruby on Rails

Comments

@byhbt
Copy link
Owner

byhbt commented Jul 14, 2020

Problem:

class TwoFer
  def two_fer
    puts "1"
  end
end

When I tried to call TwoFer.two_fer then it will show the error:

Error:
TwoFerTest#test_no_name_given:
NoMethodError: undefined method `two_fer' for TwoFer:Class
    two_fer_test.rb:8:in `test_no_name_given'

Solution:

Lesson:

  • Classes and instances (and class methods and instance methods)
@byhbt byhbt added the Ruby Learning Ruby on Rails label Jul 14, 2020
@byhbt byhbt self-assigned this Jul 14, 2020
@byhbt byhbt added this to the First 50 issues milestone Jul 15, 2020
@byhbt byhbt removed their assignment Jul 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ruby Learning Ruby on Rails
Projects
None yet
Development

No branches or pull requests

1 participant