Class: NanDoc::SpecDoc::GenericAgent

Inherits:
Object
  • Object
show all
Includes:
ParseTrace
Defined in:
lib/nandoc/spec-doc/generic-agent.rb

Instance Method Summary collapse

Methods included from ParseTrace

#parse_trace, #parse_trace_assert

Constructor Details

#initialize(whatever) ⇒ GenericAgent

Returns a new instance of GenericAgent.



10
11
12
# File 'lib/nandoc/spec-doc/generic-agent.rb', line 10

def initialize whatever
  @whatever = whatever
end

Instance Method Details

#record_rubyObject



14
15
16
17
18
19
20
# File 'lib/nandoc/spec-doc/generic-agent.rb', line 14

def record_ruby
  caller_info = parse_trace_assert(caller.first)
  snip = CodeSnippet.new(caller_info)
  recordings.add(:record_ruby, snip)
  @last_snip = snip
  nil
end

#record_ruby_stopObject



22
23
24
25
26
27
28
# File 'lib/nandoc/spec-doc/generic-agent.rb', line 22

def record_ruby_stop
  line = caller.first
  caller_info = parse_trace_assert(line)
  @last_snip or fail("no record_start in method before "<<
  "record_stop at #{line}")
  @last_snip.stop_at caller_info
end

#story(name) ⇒ Object

override the one that requires we are in a method



31
32
33
# File 'lib/nandoc/spec-doc/generic-agent.rb', line 31

def story name
  recordings.add :story, name
end