addspeed' NameError (undefined local variable or method
’' for #<Dog:0x00007fffcd6da5e0 @name="Dio", @speed=14.0>)
irb(main):010:0> a.addspeed(5.0)
Traceback (most recent call last):
3: from /usr/bin/irb:11:in <main>' 2: from (irb):10 1: from ensyu1.rb:11:in
addspeed'
NameError (undefined local variable or method ’' for #<Dog:0x00007fffcd6da5e0 @name="Dio", @speed=19.0>) irb(main):011:0> load 'ensyu1.rb' => true irb(main):012:0> a.addspeed(5.0) speed = 24.0 => nil irb(main):013:0> load 'ensyu1.rb' Traceback (most recent call last): 3: from /usr/bin/irb:11:in
load' SyntaxError (ensyu1.rb:17:
@' without identifiers is not allowed as an instance variable name)
ensyu1.rb:17: syntax error, unexpected end-of-input, expecting keyword_end
@
^
irb(main):014:0> load 'ensyu1.rb'
=> true
irb(main):015:0> Dog.new('a')
initializeメソッドが実行された
=> #<Dog:0x00007fffcd6b8bc0 @name="a", @speed=0.0>
irb(main):016:0> Dog.new('a').setcount(1)
initializeメソッドが実行された
Traceback (most recent call last):
2: from /usr/bin/irb:11:in <main>' 1: from (irb):16 NoMethodError (undefined method
setcount' for #<Dog:0x00007fffcd6b5b50 @name="a", @speed=0.0>)
Did you mean? settcount
irb(main):017:0> Dog.new('a').setcount(1)
initializeメソッドが実行された
Traceback (most recent call last):
2: from /usr/bin/irb:11:in <main>' 1: from (irb):17 NoMethodError (undefined method
setcount' for #<Dog:0x00007fffcd6db8c8 @name="a", @speed=0.0>)
Did you mean? settcount
irb(main):018:0> Dog.new('a').settcount(1)
initializeメソッドが実行された
=> 1
irb(main):019:0> load 'ensyu1.rb'
=> true
irb(main):020:0> bark]
Traceback (most recent call last):
1: from /usr/bin/irb:11:in <main>' SyntaxError ((irb):20: syntax error, unexpected ']', expecting end-of-input) bark] ^ irb(main):021:0> a =Dog.new('a') initializeメソッドが実行された => #<Dog:0x00007fffcd67a230 @name="a", @speed=0.0, @count=3.0> irb(main):022:0> a => #<Dog:0x00007fffcd67a230 @name="a", @speed=0.0, @count=3.0> irb(main):023:0> a.bark Traceback (most recent call last): 3: from /usr/bin/irb:11:in
bark' NoMethodError (undefined method
times' for 3.0:Float)
irb(main):024:0>
irb(main):025:0> load 'ensyu1.rb'
=> true
irb(main):026:0> a =Dog.new('a')
initializeメソッドが実行された
=> #<Dog:0x00007fffcd59e7a8 @name="a", @speed=0.0, @count=3>
irb(main):027:0> a.bark
bark
bark
bark
=> 3
irb(main):028:0> a.setcaount
Traceback (most recent call last):
2: from /usr/bin/irb:11:in <main>' 1: from (irb):28 NoMethodError (undefined method
setcaount' for #<Dog:0x00007fffcd59e7a8 @name="a", @speed=0.0, @count=3>)
Did you mean? setcount
settcount
irb(main):029:0> a.setcount
Traceback (most recent call last):
3: from /usr/bin/irb:11:in <main>' 2: from (irb):29 1: from ensyu1.rb:15:in
setcount'
ArgumentError (wrong number of arguments (given 0, expected 1))
irb(main):030:0> a.setcount 2
=> 2
irb(main):031:0> a.bark
bark
bark
=> 2
irb(main):032:0>
まちがい