twobook 0.1.2 → 0.1.3

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: d8677b9416590ac7c8c6ca8de3404915d546ec4f
4
- data.tar.gz: 58b905e2f7df29c1c96b8a5d21f77a9cda0ed726
3
+ metadata.gz: 3e7b3f726a419064697871a5a4d6edbc04d4c46b
4
+ data.tar.gz: 2acea4e8d2b534596920c47088cef37b45822b37
5
5
  SHA512:
6
- metadata.gz: 85dbbba2586a8d6f3f0f6faa27d87c44e3b64ef32bdd71a57b54d0ca8544f024d548f28c8eef5145136ebbc1b5dc203e3760b1005eb736eaceac74a5ea79c0d3
7
- data.tar.gz: a9f9c5db7b55ca919276184086b0115a31754e531b09aab80f6ded3faec8f93ca353dbf91600a21c28d4182a42117445e4a96a1a33ad37f10b4afdc4481df751
6
+ metadata.gz: 9717e95e05805617f6d39c91e0960659afa683e45c545d0298c3288fea0b84348d0c9ad58ff17e168b7ad2d3eb92c57c74f96ce1ae1fbd8946ca4520f10cbcb3
7
+ data.tar.gz: d3de22647f48fd536e06a32b03346ddda3755c08638b31ac06a9a52daffdcb80bb7aa7b1c88ada55164259dfbd5836da334923193395fc490f184492b1e30a85
@@ -44,18 +44,17 @@ module Twobook
44
44
 
45
45
  def self.handles(event_name = nil, with: nil)
46
46
  @handles ||= {}
47
+ if event_name.nil?
48
+ # We're trying to get the handler for an event. Check all the names map to valid classes:
49
+ @handles.transform_values { |handler_names| handler_names.map { |name| Handler.from_name(name) } }
50
+ end
47
51
  return @handles if event_name.nil?
48
52
 
49
53
  if @handles[event_name].present?
50
54
  raise "Duplicate handler: more than one handler defined for #{event_name} on #{name}"
51
55
  end
52
56
 
53
- # Check that all names map to valid classes
54
- Event.from_name(event_name)
55
- handler_names = with.is_a?(Array) ? with : [with]
56
- handler_names.each { |handler_name| Handler.from_name(handler_name) }
57
-
58
- @handles[event_name] = handler_names
57
+ @handles[event_name] = with.is_a?(Array) ? with : [with]
59
58
  end
60
59
 
61
60
  def self.has(*args)
@@ -1,3 +1,3 @@
1
1
  module Twobook
2
- VERSION = '0.1.2'
2
+ VERSION = '0.1.3'
3
3
  end
data/lib/twobook.rb CHANGED
@@ -4,6 +4,7 @@ require 'active_support/inflector'
4
4
  require 'active_support/core_ext/object'
5
5
  require 'active_support/core_ext/numeric/time'
6
6
  require 'active_support/core_ext/array/access'
7
+ require 'active_support/core_ext/hash/transform_values'
7
8
  require 'active_support/core_ext/class/subclasses'
8
9
  require 'active_support/core_ext/enumerable'
9
10
  require 'twobook/number_handling'
data/twobook-0.1.2.gem ADDED
Binary file
data/twobook.gemspec CHANGED
@@ -27,5 +27,5 @@ Gem::Specification.new do |spec|
27
27
  spec.add_development_dependency 'pry', '~> 0.10'
28
28
  spec.add_development_dependency 'rb-readline', '~> 0.4.2'
29
29
 
30
- spec.add_runtime_dependency 'activesupport', '>= 4.0.0'
30
+ spec.add_runtime_dependency 'activesupport', '~> 4.0', '>= 4.0.0'
31
31
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twobook
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Parry
@@ -84,6 +84,9 @@ dependencies:
84
84
  name: activesupport
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '4.0'
87
90
  - - ">="
88
91
  - !ruby/object:Gem::Version
89
92
  version: 4.0.0
@@ -91,6 +94,9 @@ dependencies:
91
94
  prerelease: false
92
95
  version_requirements: !ruby/object:Gem::Requirement
93
96
  requirements:
97
+ - - "~>"
98
+ - !ruby/object:Gem::Version
99
+ version: '4.0'
94
100
  - - ">="
95
101
  - !ruby/object:Gem::Version
96
102
  version: 4.0.0
@@ -128,6 +134,7 @@ files:
128
134
  - lib/twobook/serialization.rb
129
135
  - lib/twobook/utilities.rb
130
136
  - lib/twobook/version.rb
137
+ - twobook-0.1.2.gem
131
138
  - twobook.gemspec
132
139
  homepage: https://github.com/parry-my/twobook
133
140
  licenses: