bbk-app 1.1.0.199675 → 1.1.0.200186

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1627d732160615549f9b53f30caccedf4edd211722a7c5abcd394094c5ab3dc3
4
- data.tar.gz: 616129ff11315119b2bf10fa924fd8203bc3227cfb9c93ce8b7651ee48ffaac5
3
+ metadata.gz: 0015bff7294750f2619f091dcd78733a7d57f7b8cce1cbf5f30740b387cd31de
4
+ data.tar.gz: 326e8891cc26e15c2f7264305edc7488444d9d1e0e5350a14d5fc6ebfa1b43e7
5
5
  SHA512:
6
- metadata.gz: 16ac439815ff4046ca4048e06c81d660cc4161dcceb1d1c102085cbadec523ab76c79cb80aaee4a1b757acf14f346407f9eb593f48912764be82e5971cf4f257
7
- data.tar.gz: 45d79789d3c65e78eb7a3ce1d19a995f2767f6f28e0ea262c36e80d8f7a9349926510b56ff58474ce7b1af318b74ebcbb621e7bde75a2b9b1b0a7fc1e4f7bb4a
6
+ metadata.gz: 9b51c79011c934f623e631dc9a361f45010e52aee8ffa65f06a8d80705cda9769dc1d3f6448ee84ad17bc0caad68720f8103f8cce1b3a2d87dfc415b3603708c
7
+ data.tar.gz: b36a555638e1055f96bd9d5996b935c014d1f3d2050c4dccba8a5c3633cbae8f8ba252e64e6189141db8cb38a2de5c63021a19812e7c662c2674ffced62f9938
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bbk-app (1.1.0.199675)
4
+ bbk-app (1.1.0.200186)
5
5
  activesupport
6
6
  bbk-utils (> 1.0.1)
7
7
  timeouter
@@ -0,0 +1,23 @@
1
+ module BBK
2
+ module App
3
+ module Domains
4
+ class ByBlock
5
+
6
+ attr_reader :name
7
+
8
+ def initialize(name, &block)
9
+ raise ArgumentError.new('no block') unless block_given?
10
+
11
+ @name = name
12
+ @block = block
13
+ end
14
+
15
+ def call(route)
16
+ @block.call(route)
17
+ end
18
+
19
+ end
20
+ end
21
+ end
22
+ end
23
+
@@ -0,0 +1,37 @@
1
+ require 'bbk/app/domains/by_block'
2
+
3
+ module BBK
4
+ module App
5
+ class DomainsSet
6
+ def initialize(*domains)
7
+ @domains = domains.map{|d| [d.name.to_s, d] }.to_h
8
+ end
9
+
10
+ # Get exchange name by domain
11
+ # @param domain_name [String] domain name
12
+ # @return [String] exchange name configured for passed domain name
13
+ def [](domain_name)
14
+ @domains[domain_name]
15
+ end
16
+
17
+ def add(domain)
18
+ @domains[domain.name.to_s] = domain
19
+ end
20
+
21
+ alias << add
22
+
23
+ # Each method implementation for object iteration
24
+ def each(&block)
25
+ @domains.values.each(&block)
26
+ end
27
+
28
+ # Check if store has information about domain
29
+ # @param domain_name [String] domain name
30
+ # @return [Boolean] has information about domain
31
+ def has?(domain_name)
32
+ @domains.key? domain_name
33
+ end
34
+
35
+ end
36
+ end
37
+ end
data/lib/bbk/app.rb CHANGED
@@ -5,6 +5,7 @@ require 'bbk/app/matchers'
5
5
  require 'bbk/app/middlewares'
6
6
  require 'bbk/app/dispatcher'
7
7
  require 'bbk/app/processors'
8
+ require 'bbk/app/domains_set'
8
9
  require 'bbk/utils/logger'
9
10
 
10
11
  module BBK
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bbk-app
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0.199675
4
+ version: 1.1.0.200186
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samoilenko Yuri
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-12-06 00:00:00.000000000 Z
11
+ date: 2023-12-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -267,6 +267,8 @@ files:
267
267
  - lib/bbk/app/dispatcher/queue_stream_strategy.rb
268
268
  - lib/bbk/app/dispatcher/result.rb
269
269
  - lib/bbk/app/dispatcher/route.rb
270
+ - lib/bbk/app/domains/by_block.rb
271
+ - lib/bbk/app/domains_set.rb
270
272
  - lib/bbk/app/factory.rb
271
273
  - lib/bbk/app/handler.rb
272
274
  - lib/bbk/app/matchers.rb