Class: Ritsudo::Collector
- Inherits:
-
Object
- Object
- Ritsudo::Collector
- Defined in:
- lib/ritsudo/collector.rb
Instance Attribute Summary collapse
-
#documents ⇒ Object
readonly
Returns the value of attribute documents.
-
#scripts ⇒ Object
readonly
Returns the value of attribute scripts.
-
#xhrs ⇒ Object
readonly
Returns the value of attribute xhrs.
Instance Method Summary collapse
- #add(_requests) ⇒ Object
- #add_misc(group, name, value) ⇒ Object
-
#initialize(documents: Ritsudo::Result::Documents.new, xhrs: Ritsudo::Result::Xhrs.new, scripts: Ritsudo::Result::Scripts.new, misc: Ritsudo::Result::Misc.new, match: nil) ⇒ Collector
constructor
A new instance of Collector.
- #report(outliters_stdev_multiple: nil) ⇒ Object
Constructor Details
#initialize(documents: Ritsudo::Result::Documents.new, xhrs: Ritsudo::Result::Xhrs.new, scripts: Ritsudo::Result::Scripts.new, misc: Ritsudo::Result::Misc.new, match: nil) ⇒ Collector
Returns a new instance of Collector.
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/ritsudo/collector.rb', line 5 def initialize(documents: Ritsudo::Result::Documents.new, xhrs: Ritsudo::Result::Xhrs.new, scripts: Ritsudo::Result::Scripts.new, misc: Ritsudo::Result::Misc.new, match: nil) @documents = documents @xhrs = xhrs @scripts = scripts @misc = misc @match = match end |
Instance Attribute Details
#documents ⇒ Object (readonly)
Returns the value of attribute documents.
3 4 5 |
# File 'lib/ritsudo/collector.rb', line 3 def documents @documents end |
#scripts ⇒ Object (readonly)
Returns the value of attribute scripts.
3 4 5 |
# File 'lib/ritsudo/collector.rb', line 3 def scripts @scripts end |
#xhrs ⇒ Object (readonly)
Returns the value of attribute xhrs.
3 4 5 |
# File 'lib/ritsudo/collector.rb', line 3 def xhrs @xhrs end |
Instance Method Details
#add(_requests) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/ritsudo/collector.rb', line 17 def add(_requests) if @match requests =_requests.select do |request| @match =~ request.url end else requests = _requests end types = requests.group_by(&:type) documents.add_multiple(types["Document"]) if types["Document"] xhrs.add_multiple(types["XHR"]) if types["XHR"] scripts.add_multiple(types["Script"]) if types["Script"] end |
#add_misc(group, name, value) ⇒ Object
32 33 34 |
# File 'lib/ritsudo/collector.rb', line 32 def add_misc(group, name, value) @misc.add(group, name, value) end |
#report(outliters_stdev_multiple: nil) ⇒ Object
36 37 38 39 40 41 42 43 44 45 |
# File 'lib/ritsudo/collector.rb', line 36 def report(outliters_stdev_multiple: nil) @misc.report(outliters_stdev_multiple: outliters_stdev_multiple) puts "" @documents.report(outliters_stdev_multiple: outliters_stdev_multiple) puts "" @xhrs.report(outliters_stdev_multiple: outliters_stdev_multiple) puts "" @scripts.report(outliters_stdev_multiple: outliters_stdev_multiple) puts "" end |