Module: Kata::Base
- Defined in:
- lib/kata/base.rb
Constant Summary collapse
- @@times =
[]
Instance Method Summary collapse
- #context(txt) ⇒ Object
- #detail(txt) ⇒ Object
- #example(txt) ⇒ Object
- #kata(txt, lib = nil) ⇒ Object
- #requirement(txt) ⇒ Object
Instance Method Details
#context(txt) ⇒ Object
12 13 14 15 |
# File 'lib/kata/base.rb', line 12 def context txt puts indent + txt yield if block_given? end |
#detail(txt) ⇒ Object
38 39 40 |
# File 'lib/kata/base.rb', line 38 def detail txt puts indent + '- ' + txt end |
#example(txt) ⇒ Object
34 35 36 |
# File 'lib/kata/base.rb', line 34 def example txt puts indent + '- ' + txt end |
#kata(txt, lib = nil) ⇒ Object
5 6 7 8 9 10 |
# File 'lib/kata/base.rb', line 5 def kata txt, lib = nil @kata_name = txt puts "#{@kata_name} Kata" yield if block_given? complete end |
#requirement(txt) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/kata/base.rb', line 17 def requirement txt puts indent + txt start = Time.now yield if block_given? rsp = ask "\ncompleted (Y|n): ", 'y' puts elapsed = Time.now - start @@times << {:title => txt, :time => elapsed} complete false if rsp.downcase == 'n' end |