lib/har/viewer.rb in har-0.0.2 vs lib/har/viewer.rb in har-0.0.3
- old
+ new
@@ -8,30 +8,31 @@
def initialize(args)
@running = false
@options = parse(args)
- @har = merge archives_from(args)
+ if @options[:validate]
+ args = validate(args)
+ end
+
+ @har = Archive.by_merging(args)
end
def show
s = server(create_root)
launch_browser
s.join
end
private
- def archives_from(hars)
- hars = hars.map { |path| Archive.from_file(path) }
+ def validate(hars)
+ progress("Validating archives...") {
+ hars = hars.map { |path| Archive.from_file(path) }
+ hars.each { |h| h.validate! }
- if @options[:validate]
- progress("Validating archives...") do
- hars.each { |h| h.validate! }
- end
- end
-
- hars
+ hars
+ }
end
def create_root
progress("Creating viewer...") {
viewer = File.expand_path("../viewer", __FILE__)
\ No newline at end of file