Module: Watchdocs::Rails::Recordings

Defined in:
lib/watchdocs/rails/recordings.rb,
lib/watchdocs/rails/recordings/exporter.rb,
lib/watchdocs/rails/recordings/recorder.rb
more...

Defined Under Namespace

Modules: Exporter Classes: Recorder

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.storeObject (readonly)

Returns the value of attribute store.


8
9
10
# File 'lib/watchdocs/rails/recordings.rb', line 8

def store
  @store
end

Class Method Details

.clear!(from_specs: true) ⇒ Object

[View source]

16
17
18
19
20
21
22
# File 'lib/watchdocs/rails/recordings.rb', line 16

def clear!(from_specs: true)
  set_store(from_specs)
  clear_recordings
rescue StandardError => e
  $stderr.puts "Watchdocs Error: #{e.message}.
                Please report it to hi@watchdocs.io"
end

.export(recordings = nil, from_specs: true) ⇒ Object

[View source]

24
25
26
27
28
29
30
31
32
33
# File 'lib/watchdocs/rails/recordings.rb', line 24

def export(recordings = nil, from_specs: true)
  set_store(from_specs)
  recordings ||= current_recordings
  return unless current_recordings
  export_recorings(recordings) && clear!(from_specs: from_specs)
  $stderr.puts "Watchdocs: #{recordings.count} requests exported"
rescue StandardError => e
  $stderr.puts "Watchdocs Error: #{e.message}.
                Please report it to hi@watchdocs.io"
end

.record(new_call, from_specs: true) ⇒ Object

[View source]

10
11
12
13
14
# File 'lib/watchdocs/rails/recordings.rb', line 10

def record(new_call, from_specs: true)
  Recorder.new(
    from_specs: from_specs
  ).call(new_call)
end