pickynode 0.1.3 → 0.1.4

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
  SHA1:
3
- metadata.gz: f730e5368a59d75e087733cfb5cac8f39ee2205c
4
- data.tar.gz: a2f0fa712034104a4b8142a46f350212964ee888
3
+ metadata.gz: 702cd10448727e96f341a26c08c971bb0f17bd97
4
+ data.tar.gz: 489e7d774e5c27e96595f26e262b24c7c13d68b5
5
5
  SHA512:
6
- metadata.gz: e10e3558312a30d47fb11421d3567ccf0c443fd9be43512450cef620f559d4262e1047dec7c084390b4a6ee4f30265983aa053d4a13e81fa7a1023f68f54b88f
7
- data.tar.gz: 7bee810ab2b249a92e6cc159b44300cff1f88f94179f8a67a2538ce435ac74dc1b2f8ef9be5912ea2350b1f9825ae8d2a1dec56fe86adb21408457c440a444e9
6
+ metadata.gz: fc42867734de71d7f6febfe971511df2eff482d85e75d638b76bd17059d25e65ef01d5e10762777943def956abe2c4bca6c04e279594804efc8a12d5d7ec5d23
7
+ data.tar.gz: 56f4542daf463e1404314e251e298b255ca22f82ab54f844f7e5b4b520a2df75c771cd4f931fdc82c6143f577aefecf0f045dadd39597b1f6fef71254e11f914
data/README.md CHANGED
@@ -45,7 +45,7 @@ pickynode --disconnect=USER_AGENT_FILTER
45
45
  ### Help:
46
46
 
47
47
  ```
48
- pickynode v0.1.3
48
+ pickynode v0.1.4
49
49
  Options:
50
50
  -a, --add=<s> Add node type
51
51
  -c, --connect=<s> Connect to node type
data/lib/pickynode.rb CHANGED
@@ -9,7 +9,7 @@ require 'uri'
9
9
  # Allows you to easily add/ban/connect/disconnect nodes
10
10
  # based on User Agent.
11
11
  class Pickynode
12
- VERSION = '0.1.3'
12
+ VERSION = '0.1.4'
13
13
 
14
14
  def initialize(opts = {})
15
15
  @opts = opts
@@ -18,11 +18,10 @@ class Pickynode
18
18
  def add(filter, limit = nil)
19
19
  return unless filter
20
20
 
21
- raise 'Limit must be greater than 0' unless valid_limit?(limit)
21
+ validate_limit(limit)
22
22
 
23
23
  count = 0
24
- bitnode_addr_types.each do |k, v|
25
- next unless v.include?(filter)
24
+ bitnode_addr_types.select { |_, v| v.include?(filter) }.each do |k, _|
26
25
  run_cmd(%(bitcoin-cli addnode "#{k}" "add"))
27
26
  count += 1
28
27
  break if limit == count
@@ -42,11 +41,10 @@ class Pickynode
42
41
  def connect(filter, limit = nil)
43
42
  return unless filter
44
43
 
45
- raise 'Limit must be greater than 0' unless valid_limit?(limit)
44
+ validate_limit(limit)
46
45
 
47
46
  count = 0
48
- bitnode_addr_types.each do |k, v|
49
- next unless v.include?(filter)
47
+ bitnode_addr_types.select { |_, v| v.include?(filter) }.each do |k, _|
50
48
  run_cmd(%(bitcoin-cli addnode "#{k}" "onetry"))
51
49
  count += 1
52
50
  break if limit == count
@@ -130,8 +128,8 @@ class Pickynode
130
128
  `bitcoin-cli getpeerinfo`
131
129
  end
132
130
 
133
- def valid_limit?(limit)
134
- return true unless limit
135
- limit > 0
131
+ def validate_limit(limit)
132
+ return unless limit
133
+ raise 'Limit must be greater than 0' unless limit > 0
136
134
  end
137
135
  end
data/pickynode.gemspec CHANGED
@@ -5,7 +5,6 @@ require File.expand_path(File.join('..', 'lib', 'pickynode'), __FILE__)
5
5
  Gem::Specification.new do |s|
6
6
  s.name = 'pickynode'
7
7
  s.version = Pickynode::VERSION
8
- s.date = '2017-05-19'
9
8
  s.summary = 'Manage connections to your bitcoin node'
10
9
  s.description = "Some people are picky about the \
11
10
  bitcoin nodes they connect to."
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pickynode
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Ellithorpe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-19 00:00:00.000000000 Z
11
+ date: 2017-06-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: awesome_print