yuslow 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/yuslow.rb +32 -0
  3. metadata +58 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: bfd953740e32fb7b75846380345a9574985088e04515198336ded5a33fe3953a
4
+ data.tar.gz: 5c611848b2a5be441b54063854cf65e127bf323266f3e7f48ba44f1fc5a2d837
5
+ SHA512:
6
+ metadata.gz: bad736143507ff82c224514901d4f375aeed60d5666772817cf8d764f45cec5f42d6a8d85231de60f29b7e3ce46bed39fdc5ed7860874f5dc4e2c80a65f6355f
7
+ data.tar.gz: ed0bba601e95633f94e97ae6b17db4f9d93e0249dfbee20258cb1629e4d1ddc8f534cc435fac00dd624a6bdc7628deeb64214ed6f2b4972135c896e8c5b42696
data/lib/yuslow.rb ADDED
@@ -0,0 +1,32 @@
1
+ require_relative 'yuslow/investigation'
2
+ require_relative 'yuslow/operation'
3
+ require_relative 'yuslow/stdout_printer'
4
+
5
+ module Yuslow
6
+ extend self
7
+
8
+ def run(debug: false, output: nil)
9
+ raise 'Block expected' unless block_given?
10
+
11
+ investigation = Investigation.new debug: debug, printer: printer_from(output)
12
+ investigation.start
13
+ yield
14
+ investigation.finish
15
+ investigation
16
+ end
17
+
18
+ def investigation(debug: false, output: nil)
19
+ Investigation.new debug: debug, printer: printer_from(output)
20
+ end
21
+
22
+ private
23
+
24
+ def printer_from(param)
25
+ case param
26
+ when false then nil
27
+ when :stdout then StdoutPrinter
28
+ else
29
+ StdoutPrinter
30
+ end
31
+ end
32
+ end
metadata ADDED
@@ -0,0 +1,58 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: yuslow
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Deyan Dobrinov
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2021-01-24 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rspec
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '3.10'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '3.10'
27
+ description: Y U Slow gives you a simple way to break down and debug why specific
28
+ piece of code is slow.
29
+ email: deyan.dobrinov@gmail.com
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - lib/yuslow.rb
35
+ homepage: https://github.com/dobrinov/yuslow
36
+ licenses:
37
+ - MIT
38
+ metadata: {}
39
+ post_install_message:
40
+ rdoc_options: []
41
+ require_paths:
42
+ - lib
43
+ required_ruby_version: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ required_rubygems_version: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: '0'
53
+ requirements: []
54
+ rubygems_version: 3.0.3
55
+ signing_key:
56
+ specification_version: 4
57
+ summary: Lightweight profiler for Ruby
58
+ test_files: []