Permalink
Browse files

gen comment to fill code

  • Loading branch information...
1 parent 452f4e1 commit cd8be913901fb50a8f880013cc5d1285a9a58546 @sathish316 sathish316 committed Aug 28, 2011
Showing with 7 additions and 10 deletions.
  1. +1 −0 Rakefile
  2. +3 −5 koans/about_define_method.rb
  3. +3 −5 src/about_define_method.rb
View
@@ -24,6 +24,7 @@ module Koans
line = line.gsub(/assert_equal [\:"']?([\w\s\!']+)['"]?,/, "assert_equal __,")
line = line.gsub(/assert_match \/(.*?)\//, "assert_match /__/")
line = line.gsub(/assert_raises(\w+)\//, "assert_raises(___)")
+ line = line[line.index('#Write code here'), line.length] if line =~ /#Write code here/
line
end
@@ -58,16 +58,14 @@ module Accessor
def my_writer(name)
ivar_name = "@#{name}"
define_method "#{name}=" do |value|
- #Write code here to set value of ivar
- instance_variable_set(ivar_name, value)
+#Write code here to set value of ivar
end
end
def my_reader(name)
ivar_name = "@#{name}"
- define_method name do
- #Write code here to get value of ivar
- instance_variable_get(ivar_name)
+ define_method name do
+#Write code here to get value of ivar
end
end
end
@@ -58,16 +58,14 @@ module Accessor
def my_writer(name)
ivar_name = "@#{name}"
define_method "#{name}=" do |value|
- #Write code here to set value of ivar
- instance_variable_set(ivar_name, value)
+ instance_variable_set(ivar_name, value) #Write code here to set value of ivar
end
end
def my_reader(name)
ivar_name = "@#{name}"
- define_method name do
- #Write code here to get value of ivar
- instance_variable_get(ivar_name)
+ define_method name do
+ instance_variable_get(ivar_name) #Write code here to get value of ivar
end
end
end

0 comments on commit cd8be91

Please sign in to comment.