Class: HAR::Viewer

Inherits:
Object
  • Object
show all
Defined in:
lib/har/viewer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Viewer

Returns a new instance of Viewer.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/har/viewer.rb', line 9

def initialize(args)
  @running = false
  @options = parse(args)

  if args == ["-"] || args.empty?
    progress("Reading HAR from stdin...") {
      @har = Archive.from_file $stdin
    }

    validate_if_needed @har
  else
    hars = validate_if_needed(args)

    progress("Merging HARs...") {
      @har = Archive.by_merging hars
    }
  end
end

Instance Attribute Details

#harObject (readonly)

Returns the value of attribute har.



7
8
9
# File 'lib/har/viewer.rb', line 7

def har
  @har
end

#optionsObject (readonly)

Returns the value of attribute options.



7
8
9
# File 'lib/har/viewer.rb', line 7

def options
  @options
end

Instance Method Details

#showObject



28
29
30
31
32
# File 'lib/har/viewer.rb', line 28

def show
  s = server(create_root)
  launch_browser
  s.join
end