snmp-open 0.1.1 → 0.1.2

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: 5f5f31288054f467dd80af94303c650adb60d8e6
4
- data.tar.gz: 055b4581a3151737dc7b6027c19c17c2e43c563f
3
+ metadata.gz: 55313ea1a6642173d99b42f50c381593adcaf93e
4
+ data.tar.gz: 4500b9b1250ab216871cf0e517b8a1d47f683bed
5
5
  SHA512:
6
- metadata.gz: ddfdc84646517ad15ae203b4f8c8776e8a3da371336298f62c100e336432d674f64127837d365eb437bac0d2fd63676712fd100778009b944daff50bd579f5c2
7
- data.tar.gz: dca85d9c73d4a41943c6d83eaf38024af48edf7b7e5d4c6dc6206d944eadc76e2edba9809b2add5f71814b85c2fef7d754eef43e2c310e1abe2b3588f2a9c6b1
6
+ metadata.gz: e9ac99bdf0c59be35c8934a4376e7a51a6fa54816608395654d2ef40e5892e62809f40154b654297672a686c86b52e0b80330470b62cf29c7c1fdb440709ce53
7
+ data.tar.gz: 19f0e812245542f3ba4161287c41960f414ab3cf39b5546d661e415adbe7e76883a2ba01ceea46ea2e3218c85f546e950d24a7da1ca4ed4f471338642c222462
data/lib/snmp/open.rb CHANGED
@@ -72,14 +72,16 @@ module SNMP
72
72
  # Perform an SNMP get using the "snmpget" command and parse the output
73
73
  def get(oids)
74
74
  return enum_for(:get, oids) unless block_given?
75
- texts = oids.map { |oid| capture_command(:walk, oid) }
75
+ texts = oids.map { |oid| capture_command(:get, oid) }
76
76
  Parser.new(oids).parse(texts).each { |arg, *| yield(arg) }
77
77
  end
78
78
 
79
79
  # Perform an SNMP walk using the "snmpwalk" or "snmpbulkwalk" commands and
80
80
  # parse the output
81
- def walk(oids, bulk: true, non_repeaters: 0, max_repetitions: 10)
82
- return enum_for(:walk, oids) unless block_given?
81
+ def walk(oids, **kwargs)
82
+ kwargs = { bulk: true, non_repeaters: 0, max_repetitions: 10 }
83
+ .merge(kwargs)
84
+ return enum_for(:walk, oids, **kwargs) unless block_given?
83
85
  cmd = bulk ? :bulkwalk : :walk
84
86
  options = bulk ? { '-Cn' => non_repeaters, '-Cr' => max_repetitions } : {}
85
87
  texts = oids.map { |oid| capture_command(cmd, oid, options) }
@@ -1,5 +1,5 @@
1
1
  module Snmp
2
2
  module Open
3
- VERSION = '0.1.1'.freeze
3
+ VERSION = '0.1.2'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: snmp-open
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Miller
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-03-13 00:00:00.000000000 Z
11
+ date: 2017-03-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler