xray-rails 0.2.0 → 0.3.0

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
  SHA1:
3
- metadata.gz: af26d9471fb39cf9697c4142f11d1218b282949f
4
- data.tar.gz: 2dec43a0a579d6cce8a8159c3b97cb5a42d6168d
3
+ metadata.gz: 90126528bd463acc13b70d3524a2b52764ca4543
4
+ data.tar.gz: 50d91170ce09b2222925d4515d288b2a0736a8ab
5
5
  SHA512:
6
- metadata.gz: 36432e25ecbaa3cebacb6d6942de25567e7af1a082baea0f3946c821a2260aea6f53d436c4109f7428051db2c080daacf68a9f1821895dd37d757bc0f74725aa
7
- data.tar.gz: ac7a9ef35f340e7e039d3f0a438c69e7b17e0de362f07a52af7c15e9326fa431cfd0bcc04987aeaab92dda88b5d51cf3da12992e7e99c54dac8b2276378921c6
6
+ metadata.gz: 1f265795ab69c9e76f6b5afcf5837323d507fb02cf24e3fc3802dee8dc038c0ae89b670f83e62a4b72e4c24db7b976e42db226552cfe1318923db434341b74c4
7
+ data.tar.gz: fd428470fadd89218b169da0219507e25e869ce59b45b3524659e660113d2f644b7e572716f6ed27130475282a5604d92b515e0e417cb3bd82ad24123fff3900
@@ -1,6 +1,7 @@
1
1
  require "json"
2
2
  require "active_support/all"
3
3
  require_relative "xray/version"
4
+ require_relative "xray/aliasing"
4
5
  require_relative "xray/config"
5
6
  require_relative "xray/middleware"
6
7
 
@@ -0,0 +1,38 @@
1
+ module Xray
2
+ # This module implements the old ActiveSupport alias_method_chain feature
3
+ # with a new name, and without the deprecation warnings. In ActiveSupport 5+,
4
+ # this style of patching was deprecated in favor of Module.prepend. But
5
+ # Module.prepend is not present in Ruby 1.9, which we would still like to
6
+ # support. So we continue to use of alias_method_chain, albeit with a
7
+ # different name to avoid collisions.
8
+ #
9
+ # TODO: remove this and drop support for Ruby 1.9.
10
+ #
11
+ module Aliasing
12
+ # This code is copied and pasted from ActiveSupport, but with :xray
13
+ # hardcoded as the feature name, and with the deprecation warning removed.
14
+ def xray_method_alias(target)
15
+ feature = :xray
16
+
17
+ # Strip out punctuation on predicates, bang or writer methods since
18
+ # e.g. target?_without_feature is not a valid method name.
19
+ aliased_target, punctuation = target.to_s.sub(/([?!=])$/, ''), $1
20
+ yield(aliased_target, punctuation) if block_given?
21
+
22
+ with_method = "#{aliased_target}_with_#{feature}#{punctuation}"
23
+ without_method = "#{aliased_target}_without_#{feature}#{punctuation}"
24
+
25
+ alias_method without_method, target
26
+ alias_method target, with_method
27
+
28
+ case
29
+ when public_method_defined?(without_method)
30
+ public target
31
+ when protected_method_defined?(without_method)
32
+ protected target
33
+ when private_method_defined?(without_method)
34
+ private target
35
+ end
36
+ end
37
+ end
38
+ end
@@ -19,6 +19,8 @@ module Xray
19
19
  # Monkey patch ActionView::Template to augment server-side templates
20
20
  # with filepath information. See `Xray.augment_template` for details.
21
21
  ActionView::Template.class_eval do
22
+ extend Xray::Aliasing
23
+
22
24
  def render_with_xray(*args, &block)
23
25
  path = identifier
24
26
  view = args.first
@@ -37,7 +39,7 @@ module Xray
37
39
  source
38
40
  end
39
41
  end
40
- alias_method_chain :render, :xray
42
+ xray_method_alias :render
41
43
  end
42
44
 
43
45
  # Sprockets preprocessor interface which supports all versions of Sprockets.
@@ -1,3 +1,3 @@
1
1
  module Xray
2
- VERSION = "0.2.0".freeze
2
+ VERSION = "0.3.0".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xray-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brent Dillingham
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-23 00:00:00.000000000 Z
11
+ date: 2017-04-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -109,6 +109,7 @@ files:
109
109
  - app/assets/stylesheets/xray.css
110
110
  - app/views/_xray_bar.html.erb
111
111
  - lib/xray-rails.rb
112
+ - lib/xray/aliasing.rb
112
113
  - lib/xray/config.rb
113
114
  - lib/xray/engine.rb
114
115
  - lib/xray/middleware.rb
@@ -133,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
133
134
  version: '0'
134
135
  requirements: []
135
136
  rubyforge_project:
136
- rubygems_version: 2.5.1
137
+ rubygems_version: 2.6.11
137
138
  signing_key:
138
139
  specification_version: 4
139
140
  summary: Reveal the structure of your UI