karma 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
  SHA256:
3
- metadata.gz: ece4fcc71dff9720e07830b8b6edbdf951338b8f15b95b5c72fe6945495ad748
4
- data.tar.gz: 1022d07ed67ba6f46d95e1b2807d086000b0950d65b2e986289120a8c75f81e2
3
+ metadata.gz: 96ca4d676420829dd458cf282017325e3ee545f66a0318e9b457f66bceda011a
4
+ data.tar.gz: 95c31c4476a2e85fd152d9cecc964136b3ea12c6e1a45f38c63cc97b4f2abc84
5
5
  SHA512:
6
- metadata.gz: ed2f81c6cb1ef0d4d8dd25d473338cb68d66f63e48c2e32c93bcb185cced7935f8721cfb720cc0f108b31d0e8b55cdb1236aee067715b76d25a2b3665fb846c4
7
- data.tar.gz: 46d7ae0f5f2b47c7039687343b78d799c5e773cb6881314e7026637fa248c467dfd73898bdfaeb522516a6cec5eb2301689907b49cf1253e0bbe5b6b00271ea8
6
+ metadata.gz: 78cd74834edb96a785780c74f521639b6476f7842294ff198166fdd0333239b94cf3adfc293a7a17883e3ba632157237ec010f9a7ee5e492cd963dc3312fb865
7
+ data.tar.gz: deefe72e812e5538b2e576a3e13e7f70e7b1bcdfca99c74964b86f077da12ff5e314ba32d30ca60a87e7945f43f1174146bbe396671977b17bef371a1bd7e06a
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- karma (0.1.2)
4
+ karma (0.1.3)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/lib/karma/config.rb CHANGED
@@ -1,18 +1,22 @@
1
1
  module Karma
2
- Config = Struct.new(:host, :port) do
2
+ class << self
3
+ attr_accessor :configuration
4
+ end
5
+
6
+ class Configuration
7
+ attr_accessor :port, :host
8
+
3
9
  def initialize
4
- self.port = 8080
5
- self.host = 'localhost'
10
+ @host = 'localhost'
11
+ @port = 8080
6
12
  end
7
13
  end
8
14
 
9
15
  def self.configure
10
- @config = Config.new
11
- yield(@config) if block_given?
12
- @config
16
+ yield(configuration)
13
17
  end
14
18
 
15
- def self.config
16
- @config || configure
19
+ def self.configuration
20
+ @@configuration ||= Configuration.new
17
21
  end
18
22
  end
@@ -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
 
@@ -49,7 +47,8 @@ module Karma
49
47
 
50
48
  def establish_connection!
51
49
  @socket = TCPSocket.new(
52
- @host, @port,
50
+ Karma.configuration.host,
51
+ Karma.configuration.port,
53
52
  connect_timeout: 0.5
54
53
  )
55
54
  end
data/lib/karma/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Karma
4
- VERSION = "0.1.2"
4
+ VERSION = "0.1.3"
5
5
  end
data/lib/karma.rb CHANGED
@@ -1,6 +1,5 @@
1
1
  require 'json'
2
2
  require 'socket'
3
- require 'ostruct'
4
3
 
5
4
  require 'karma/version'
6
5
  require 'karma/config'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: karma
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
  - Sergey Fedorov