karma 0.1.2 → 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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/karma/config.rb +12 -8
- data/lib/karma/connection.rb +4 -6
- data/lib/karma/version.rb +1 -1
- data/lib/karma.rb +0 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e31b4cc150b92d64ae5abd3b4f971d97851eb96e808d31e0c9e57878272d20e
|
4
|
+
data.tar.gz: f168ddc0e1ebedbdb1bbb1d390d6610af5cb042a113747299d005d442c30dd5f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e8e0013f78f62f58078d8a94e2c77eb42a6b52f403456c4ee901ce00d5d89780cec27552beb6b98e3124313fc18d8e38fe40c98d21d7773baf9ea9cdf05ec13
|
7
|
+
data.tar.gz: a5e5198aa070ba86d48c97933a9029e1f7eeb36156c04dfd44bda70736ff9352e849a29510718c2873421e2daa798a2b6cc76b0702cd1ae329156d6a8e666a75
|
data/Gemfile.lock
CHANGED
data/lib/karma/config.rb
CHANGED
@@ -1,18 +1,22 @@
|
|
1
1
|
module Karma
|
2
|
-
|
2
|
+
class << self
|
3
|
+
attr_accessor :configuration
|
4
|
+
end
|
5
|
+
|
6
|
+
class Configuration
|
7
|
+
attr_accessor :port, :host
|
8
|
+
|
3
9
|
def initialize
|
4
|
-
|
5
|
-
|
10
|
+
@host = 'localhost'
|
11
|
+
@port = 8080
|
6
12
|
end
|
7
13
|
end
|
8
14
|
|
9
15
|
def self.configure
|
10
|
-
|
11
|
-
yield(@config) if block_given?
|
12
|
-
@config
|
16
|
+
yield(configuration)
|
13
17
|
end
|
14
18
|
|
15
|
-
def self.
|
16
|
-
|
19
|
+
def self.configuration
|
20
|
+
@@configuration ||= Configuration.new
|
17
21
|
end
|
18
22
|
end
|
data/lib/karma/connection.rb
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
module Karma
|
2
2
|
class Connection
|
3
3
|
def initialize
|
4
|
-
@port = Karma.config.port
|
5
|
-
@host = Karma.config.host
|
6
4
|
@maxlen = 4096
|
7
5
|
end
|
8
6
|
|
@@ -10,7 +8,7 @@ module Karma
|
|
10
8
|
unless defined?(@socket)
|
11
9
|
establish_connection!
|
12
10
|
end
|
13
|
-
|
11
|
+
push(request)
|
14
12
|
read
|
15
13
|
end
|
16
14
|
|
@@ -25,7 +23,7 @@ module Karma
|
|
25
23
|
end
|
26
24
|
end
|
27
25
|
|
28
|
-
def
|
26
|
+
def push(message)
|
29
27
|
message = message.to_json
|
30
28
|
connect do |conn|
|
31
29
|
conn.send("#{message}\r\n", 0)
|
@@ -49,8 +47,8 @@ module Karma
|
|
49
47
|
|
50
48
|
def establish_connection!
|
51
49
|
@socket = TCPSocket.new(
|
52
|
-
|
53
|
-
|
50
|
+
Karma.configuration.host,
|
51
|
+
Karma.configuration.port
|
54
52
|
)
|
55
53
|
end
|
56
54
|
|
data/lib/karma/version.rb
CHANGED
data/lib/karma.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: karma
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sergey Fedorov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-07-
|
11
|
+
date: 2023-07-09 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Ruby client for the Karma key-counter database
|
14
14
|
email:
|