rshade 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c22edeb524363703e1593cc552713c7e9cef6203ab2df81d1c52ce1d39b8e68f
4
- data.tar.gz: ac8080bc18e8c4ef3ebe9274815c35cbbd201cc210791c914f366786648f07e7
3
+ metadata.gz: 9281517b2b803fce72f087275a58e1c9ef2faaf773bf283dfc5ebd10449027fe
4
+ data.tar.gz: a2f85eca60c61e7e6e7c04373285891b28122148c2259e86805bd65e4c2f1085
5
5
  SHA512:
6
- metadata.gz: e8803cd8aa9df51f749d3e68ec9a8bb86aad01d731ce69b69862f5d105fea6297c8933092b20a66a1f3a2fd62a762da11b765e4c944cd9ccd6e65a88a7483168
7
- data.tar.gz: 637c5715a9404d2e491919f32658ac499027d39cf85c126a804f6b44f5a15aa0bc469483deae67f7516f3735bd873c450105baae34a3d042c6428ed815cfe9b6
6
+ metadata.gz: 5bb3915ccc4b7be98285e0fe5e95c43e816d7cce9e116e6932c2ec905317ab807ef05769274f1fb3b7563556351c39c3331c139b8829d35694e4e22cc5e20985
7
+ data.tar.gz: 17e50c4d6f1b660e3104ecfd53e6aa539fcc58672cae00a4392842ce9013ff3a7badf9a1880fa816ee55ae5a3c6b63e80962f8fdfea70715fcb2b1059d10ed67
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rshade (0.1.3)
4
+ rshade (0.1.4)
5
5
  colorize
6
6
 
7
7
  GEM
@@ -1,4 +1,5 @@
1
1
  require 'colorize'
2
+ require 'rshade/configuration'
2
3
  require 'rshade/source'
3
4
  require 'rshade/tree'
4
5
  require 'rshade/source_node'
@@ -6,7 +7,20 @@ require 'rshade/trace'
6
7
  require 'rshade/rspec'
7
8
  require 'rshade/version'
8
9
 
10
+
9
11
  module RShade
10
12
  APP_TRACE = :app_trace
11
13
  FULL_TRACE = :full_trace
14
+
15
+ class << self
16
+ attr_writer :config
17
+
18
+ def configuration
19
+ @config ||= Configuration.new
20
+ end
21
+
22
+ def configure
23
+ yield configuration
24
+ end
25
+ end
12
26
  end
@@ -0,0 +1,32 @@
1
+ module RShade
2
+ class Configuration
3
+ RUBY_VERSION_PATTERN = /ruby-[0-9.]*/
4
+
5
+ attr_accessor :custom_arg_print, :included_gems
6
+
7
+ def initialize
8
+ @included_gems = []
9
+ end
10
+
11
+ def default_arg_print(args)
12
+
13
+ end
14
+
15
+ def excluded_paths
16
+ @excluded_paths ||= begin
17
+ paths = [ENV['GEM_PATH'].split(':'), parse_ruby_version].flatten.compact
18
+ paths.reject do |v|
19
+ included_gems.any? { |gem_name| v.include? gem_name }
20
+ end
21
+ end
22
+ end
23
+
24
+ def parse_ruby_version
25
+ val = RUBY_VERSION_PATTERN.match(ENV['GEM_PATH'])
26
+ return nil unless val
27
+
28
+ val[0]
29
+ end
30
+
31
+ end
32
+ end
@@ -2,11 +2,11 @@ module RShade
2
2
  REPORTS = []
3
3
 
4
4
  module RSpecHelper
5
- def rshade_reveal(type = ::RShade::APP_TRACE)
5
+ def rshade_reveal(type = ::RShade::APP_TRACE, options = {})
6
6
  raise 'No block given' unless block_given?
7
7
 
8
8
  trace = Trace.new
9
- trace.reveal do
9
+ trace.reveal(options) do
10
10
  yield
11
11
  end
12
12
 
@@ -1,7 +1,6 @@
1
1
  module RShade
2
2
  # nodoc
3
3
  class Source
4
- RUBY_VERSION_PATTERN = /ruby-[0-9.]*/
5
4
 
6
5
  def initialize(hash)
7
6
  @hash = hash
@@ -16,7 +15,7 @@ module RShade
16
15
  end
17
16
 
18
17
  def app_code?
19
- @app_code ||= exclude_path.none? { |item| path.include? item }
18
+ @app_code ||= RShade.configuration.excluded_paths.none? { |item| path.include? item }
20
19
  end
21
20
 
22
21
  def path
@@ -35,18 +34,6 @@ module RShade
35
34
  @hash[:vars]
36
35
  end
37
36
 
38
- def exclude_path
39
- @path_arr ||= begin
40
- [ENV['GEM_PATH'].split(':'), parse_ruby_version].flatten.compact
41
- end
42
- end
43
-
44
- def parse_ruby_version
45
- val = RUBY_VERSION_PATTERN.match(ENV['GEM_PATH'])
46
- return nil unless val
47
-
48
- val[0]
49
- end
50
37
 
51
38
  def pretty
52
39
  class_method = "#{klass}##{method_name}".colorize(:green)
@@ -1,6 +1,6 @@
1
1
  module RShade
2
2
  class Trace
3
- attr_accessor :source_tree, :open, :close, :set
3
+ attr_accessor :source_tree, :options
4
4
  EVENTS = %i[call return].freeze
5
5
 
6
6
  def initialize
@@ -9,7 +9,7 @@ module RShade
9
9
  @stack = [@source_tree]
10
10
  end
11
11
 
12
- def reveal
12
+ def reveal(options = {})
13
13
  return unless block_given?
14
14
 
15
15
  @tp.enable
@@ -1,3 +1,3 @@
1
1
  module RShade
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rshade
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ivan Lopatin
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-08-14 00:00:00.000000000 Z
11
+ date: 2019-11-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize
@@ -84,6 +84,7 @@ files:
84
84
  - bin/console
85
85
  - bin/setup
86
86
  - lib/rshade.rb
87
+ - lib/rshade/configuration.rb
87
88
  - lib/rshade/rspec.rb
88
89
  - lib/rshade/source.rb
89
90
  - lib/rshade/source_node.rb