modulation 0.22 → 0.23

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: 2c3934a1afb8521b3ec5868ea4b7d1b80448b77c928ac00c6959a20a9d992c90
4
- data.tar.gz: 1ff3b5b77a1add4bd03225557106127f154de4ec17d4f94cbe15dba29d9ef701
3
+ metadata.gz: d5c49015c128b42973ab89aa6f4de9bcb7c6d12b224fe7451060cf3d0ac3eb31
4
+ data.tar.gz: e733c59b1c03b76557a8ddcc74f518e3820d222c3e9812583275991d8550b957
5
5
  SHA512:
6
- metadata.gz: ba5b255f4a4d704f9a24aa40eea62bd8d78ea10a822928dd3d7e134cc21b28ff370f1a58be8f0f19d8d22c9cd897db36757f669c9d12393f6bf6774bc2e5c6e9
7
- data.tar.gz: a3063a6bd099b11e5cfe00ef120e868d72cc348e2426064add023c5c0e67dbdd7f12183f6568ba0714f2088e8b3c5415ea6cfb9daec7e461066add9cb637e13e
6
+ metadata.gz: fd91d28403805c34fb98528f5d0181c6e8fc92c822e355bc94041d6da325f4753853fe74cb86fbabdb364889c5c55820e235e9e3296374808df73cfe295a9899
7
+ data.tar.gz: 15c8c550c91494f8c52f5d804b77b3f6fcc2b0445b72993850bef63064ce84526f73a50663bc954ec002e772faa0dd8ffa1b956d9a9733d372792fc65820729c
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ 0.23 2019-05-17
2
+ ---------------
3
+
4
+ * Fix regression in `#export_default`
5
+
1
6
  0.22 2019-05-15
2
7
  ---------------
3
8
 
@@ -108,7 +108,8 @@ module Modulation
108
108
 
109
109
  # Returns exported value for a default export
110
110
  # If the given value is a symbol, returns the value of the corresponding
111
- # constant.
111
+ # constant. If the symbol refers to a method, returns a proc enveloping
112
+ # the method. Raises if symbol refers to non-existent constant or method.
112
113
  # @param value [any] export_default value
113
114
  # @param mod [Module] module
114
115
  # @return [any] exported value
@@ -116,15 +117,15 @@ module Modulation
116
117
  if value.is_a?(Symbol)
117
118
  case value
118
119
  when /^[A-Z]/
119
- unless mod.singleton_class.constants(true).include?(Symbol)
120
- raise_exported_symbol_not_found_error(value, mod, :const)
121
- end
120
+ if mod.singleton_class.constants(true).include?(value)
121
+ return mod.singleton_class.const_get(value)
122
+ end
123
+ raise_exported_symbol_not_found_error(value, mod, :const)
122
124
  else
123
125
  if mod.singleton_class.instance_methods(true).include?(value)
124
126
  return proc { |*args, &block| mod.send(value, *args, &block) }
125
- else
126
- raise_exported_symbol_not_found_error(value, mod, :method)
127
127
  end
128
+ raise_exported_symbol_not_found_error(value, mod, :method)
128
129
  end
129
130
  end
130
131
  value
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Modulation
4
- VERSION = '0.22'
4
+ VERSION = '0.23'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: modulation
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.22'
4
+ version: '0.23'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sharon Rosner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-15 00:00:00.000000000 Z
11
+ date: 2019-05-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest