Ruby Ruby Blocks Blocks Practice Create a Class

MaryAnn Eleanya
MaryAnn Eleanya
8,626 Points

I don't know what I am doing wrong with the initialize method.

https://teamtreehouse.com/library/ruby-blocks/blocks-practice/create-a-class

For some reason my code is not being accepted and I don't know what the problem is.

monster.rb
class Monster
  def initialize(name, actions)
  @name = name
  @actions={}
  end
end

1 Answer

Hi MaryAnn,

I see two things wrong with your code:

  1. You should indent the code in the initialize code block.
  2. You pass in a parameter "actions" but the @actions variable is initialized as an empty hash -- there's no need to pass it as a parameter.

Hope that helps - please let me know if you have any questions and I'll be happy to help.