rmuh 0.2.6 → 0.3.0

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
  SHA1:
3
- metadata.gz: b42ffdde9b6cafc07b106a25dada77df4d37d65e
4
- data.tar.gz: 3b7cd60555b39694ec72807656b0e7062def008a
3
+ metadata.gz: 1402565d209f6d72ba95d6a17e3c7ff90d430af7
4
+ data.tar.gz: 489ef149e3f6493d091ff186363a2ad87c629853
5
5
  SHA512:
6
- metadata.gz: b786803d70135e98d668d798e46ce6a7651f23c6db297c2c4c6fe0b94167341c57fce1275f21887276970b099fdd25123bfff72c9c2a30bdec4483f767ddbd9c
7
- data.tar.gz: b5dae0477bc01d475a710d3cf7d59989cca234f78939941cf756db2d78fe79fb58571d1ae95999bea5a10096924053af83b28eac7fb419425f19412a3ddd60f4
6
+ metadata.gz: 2e9605c2296450f13b81f47a5a15875ad7be86a201583ce85662e2ccbb5d1164448009c24925d3925506324ce1cfc45fb8e9206b979f389a46d8e2aade188da0
7
+ data.tar.gz: 5c7399bccdb65f7e8e1e6f7aa9ae58b3e5d6385d5d79d8ea6d244bf32e9a6ec4d52dc89df2473cd2b701531ced7fcfa7d494c6e112a5b84046e848234a7b7da9
data/README.md CHANGED
@@ -82,7 +82,7 @@ URL = 'http://arma2.unitedoperations.net/dump/SRV1/SRV1_RPT.txt'
82
82
  f = RMuh::RPT::Log::Fetch.new(URL)
83
83
  puts f.log
84
84
  ```
85
- In this case `f.log` returns a `StringIO` object which will be used by the
85
+ In this case `f.log` returns an `Array` object which will be used by the
86
86
  parsers to parse the log files.
87
87
 
88
88
  If you want to specify a
data/Rakefile CHANGED
@@ -4,10 +4,26 @@ require 'rubocop/rake_task'
4
4
 
5
5
  RSpec::Core::RakeTask.new(:spec)
6
6
 
7
- Rubocop::RakeTask.new(:rubocop) do |t|
7
+ RuboCop::RakeTask.new(:rubocop) do |t|
8
8
  # t.patterns = %w( Rakefile Gemfile rmuh.gemspec lib/**/*.rb spec/*_spec.rb )
9
9
  t.patterns = %w( rmuh.gemspec lib/**/*.rb spec/*_spec.rb )
10
10
  t.fail_on_error = true
11
11
  end
12
12
 
13
+ RSpec::Core::RakeTask.new(:unit) do |t|
14
+ t.pattern = ['spec/spec_helper.rb', 'spec/unit/**/*_spec.rb']
15
+ end
16
+
17
+ RSpec::Core::RakeTask.new(:example) do |t|
18
+ t.pattern = ['spec/spec_helper.rb', 'spec/functional/**/*_spec.rb']
19
+ end
20
+
21
+ task :unit do
22
+ Rake::Task['unit'].invoke
23
+ end
24
+
25
+ task :example do
26
+ Rake::Task['unit'].invoke
27
+ end
28
+
13
29
  task default: [:rubocop, :spec]
@@ -19,11 +19,11 @@ URL = 'http://arma2.unitedoperations.net/dump/SRV1/SRV1_LOG.txt'
19
19
  # 1024 bytes
20
20
  f = RMuh::RPT::Log::Fetch.new(URL, byte_start: 0, byte_end: 1024)
21
21
 
22
- # logfile will become a StringIO object that is the contents of the log
22
+ # logfile will become an Array object that is the contents of the log
23
23
  logfile = f.log
24
24
 
25
25
  # print the log
26
- puts "#### The full log\n#{logfile.readlines.join("\n")}\n#### End of log!"
26
+ puts "#### The full log\n#{logfile.join("\n")}\n#### End of log!"
27
27
 
28
28
  # print the size of the log, f.size will return a Fixnum in bytes
29
29
  puts "Log size: #{f.size} byte(s)"
@@ -32,8 +32,8 @@ module RMuh
32
32
  #
33
33
  def initialize(log_url, opts = {})
34
34
  @log_url = log_url
35
- @byte_start = opts.key?(:byte_start) ? opts[:byte_start] : 0
36
- @byte_end = opts.key?(:byte_end) ? opts[:byte_end] : nil
35
+ @byte_start = opts.fetch(:byte_start, 0)
36
+ @byte_end = opts.fetch(:byte_end, nil)
37
37
  end
38
38
 
39
39
  def byte_start=(bytes)
@@ -53,7 +53,7 @@ module RMuh
53
53
  def log
54
54
  headers = { 'Range' => "bytes=#{@byte_start}-#{@byte_end}" }
55
55
  response = self.class.get(@log_url, headers: headers)
56
- StringIO.new(response.lines.map { |l| dos2unix(l) }.join)
56
+ response.lines.map { |l| dos2unix(l).gsub("\n", '') }
57
57
  end
58
58
 
59
59
  private
@@ -9,39 +9,36 @@ module RMuh
9
9
  class UnitedOperationsLog < RMuh::RPT::Log::Formatters::Base
10
10
  class << self
11
11
  def format(event)
12
- case event[:type]
13
- when :connect
14
- format_connect(event)
15
- when :disconnect
16
- format_disconnect(event)
17
- when :beguid
18
- format_beguid(event)
19
- when :chat
20
- format_chat(event)
21
- else
22
- nil
23
- end
12
+ return unless [:connect, :disconnect, :beguid, :chat]
13
+ .include?(event[:type])
14
+ send("format_#{event[:type]}".to_sym, event)
24
15
  end
25
16
 
26
17
  private
27
18
 
19
+ def ltime(e, type)
20
+ l = "#{e[:iso8601]} "
21
+ l += 'Server: ' if type == :m
22
+ l += 'Chat: ' if type == :c
23
+ l
24
+ end
25
+
28
26
  def format_connect(e)
29
- "#{e[:iso8601]} Server: Player ##{e[:player_num]} " \
27
+ "#{ltime(e, :m)}Player ##{e[:player_num]} " \
30
28
  "#{e[:player]} (#{e[:ipaddr]}) connected\n"
31
29
  end
32
30
 
33
31
  def format_disconnect(e)
34
- "#{e[:iso8601]} Server: Player #{e[:player]} disconnected\n"
32
+ "#{ltime(e, :m)}Player #{e[:player]} disconnected\n"
35
33
  end
36
34
 
37
35
  def format_beguid(e)
38
- "#{e[:iso8601]} Server: Verified GUID (#{e[:player_beguid]}) " \
36
+ "#{ltime(e, :m)}Verified GUID (#{e[:player_beguid]}) " \
39
37
  "of player ##{e[:player_num]} #{e[:player]}\n"
40
38
  end
41
39
 
42
40
  def format_chat(e)
43
- "#{e[:iso8601]} Chat: (#{e[:channel]}) #{e[:player]}: " \
44
- "#{e[:message]}\n"
41
+ "#{ltime(e, :c)}(#{e[:channel]}) #{e[:player]}: #{e[:message]}\n"
45
42
  end
46
43
  end
47
44
  end
@@ -15,15 +15,10 @@ module RMuh
15
15
  class << self
16
16
  def format(event, level = :full)
17
17
  validate_and_set_level(level)
18
- case event[:type]
19
- when :wounded
20
- format_wounded(event)
21
- when :killed
22
- format_killed(event)
23
- when :died
24
- format_died(event)
25
- when :announcement
26
- format_announcement(event)
18
+ type = event[:type]
19
+ if [:wounded, :killed, :died, :announcement].include?(type)
20
+ func = "format_#{type}".to_sym
21
+ send(func, event)
27
22
  else
28
23
  nil
29
24
  end
@@ -15,8 +15,8 @@ module RMuh
15
15
 
16
16
  def parse(loglines)
17
17
  fail(
18
- ArgumentError, 'argument 1 must be a StringIO object'
19
- ) unless loglines.is_a?(StringIO)
18
+ ArgumentError, 'argument 1 must be an Array object'
19
+ ) unless loglines.is_a?(Array)
20
20
 
21
21
  loglines.map { |line| { type: :log, message: line } }
22
22
  end
@@ -1,7 +1,6 @@
1
1
  # -*- coding: UTF-8 -*-
2
2
  require 'English'
3
3
  require 'tzinfo'
4
- require 'stringio'
5
4
  require 'rmuh/rpt/log/parsers/base'
6
5
  require 'rmuh/rpt/log/util/unitedoperations'
7
6
  require 'rmuh/rpt/log/util/unitedoperationslog'
@@ -46,14 +45,14 @@ module RMuh
46
45
  # ++
47
46
  def initialize(opts = {})
48
47
  self.class.validate_opts(opts)
49
- @include_chat = opts[:chat].nil? ? false : opts[:chat]
50
- @to_zulu = opts[:to_zulu].nil? ? true : opts[:to_zulu]
51
- @timezone = opts[:timezone].nil? ? UO_TZ : opts[:timezone]
48
+ @include_chat = opts.fetch(:chat, false)
49
+ @to_zulu = opts.fetch(:to_zulu, true)
50
+ @timezone = opts.fetch(:timezone, UO_TZ)
52
51
  end
53
52
 
54
53
  def parse(loglines)
55
- unless loglines.is_a?(StringIO)
56
- fail ArgumentError, 'arg 1 must be a StringIO object'
54
+ unless loglines.is_a?(Array)
55
+ fail ArgumentError, 'arg 1 must be an Array object'
57
56
  end
58
57
  regex_matches(loglines)
59
58
  end
@@ -61,16 +60,13 @@ module RMuh
61
60
  private
62
61
 
63
62
  def regex_matches(loglines)
63
+ regexes = [[LEFT, :disconnect], [CHAT, :chat], [JOINED, :connect],
64
+ [GUID, :beguid]]
64
65
  loglines.map do |l|
65
66
  line = nil
66
- if LEFT.match(l)
67
- line = { type: :disconnect }.merge(m_to_h($LAST_MATCH_INFO))
68
- elsif @include_chat && CHAT.match(l)
69
- line = { type: :chat }.merge(m_to_h($LAST_MATCH_INFO))
70
- elsif JOINED.match(l)
71
- line = { type: :connect }.merge(m_to_h($LAST_MATCH_INFO))
72
- elsif GUID.match(l)
73
- line = { type: :beguid }.merge(m_to_h($LAST_MATCH_INFO))
67
+ regexes.each do |reg|
68
+ next if !reg[0].match(l) || (reg[1] == :chat && !@include_chat)
69
+ line = { type: reg[1] }.merge(m_to_h($LAST_MATCH_INFO))
74
70
  end
75
71
  line_modifiers(line) unless line.nil?
76
72
  end.compact
@@ -1,5 +1,5 @@
1
1
  # -*- coding: UTF-8 -*-
2
- require 'stringio'
2
+
3
3
  require 'English'
4
4
  require 'tzinfo'
5
5
  require 'rmuh/rpt/log/parsers/base'
@@ -43,16 +43,16 @@ module RMuh
43
43
  def initialize(opts = {})
44
44
  self.class.validate_opts(opts)
45
45
 
46
- @to_zulu = opts[:to_zulu].nil? ? true : opts[:to_zulu]
47
- @timezone = opts[:timezone].nil? ? UO_TZ : opts[:timezone]
46
+ @to_zulu = opts.fetch(:to_zulu, true)
47
+ @timezone = opts.fetch(:timezone, UO_TZ)
48
48
  end
49
49
 
50
- # Parse the StringIO object which is the lines from the log.
51
- # This expects arg 1 to be a StringIO object, otherwise it will
50
+ # Parse the Array object which is the lines from the log.
51
+ # This expects arg 1 to be an Array object, otherwise it will
52
52
  # throw an ArgumentError exception
53
53
  def parse(loglines)
54
- unless loglines.is_a?(StringIO)
55
- fail ArgumentError, 'argument 1 must be a StringIO object'
54
+ unless loglines.is_a?(Array)
55
+ fail ArgumentError, 'argument 1 must be an Array object'
56
56
  end
57
57
 
58
58
  loglines.map do |l|
@@ -5,8 +5,8 @@
5
5
  #
6
6
  module RMuh
7
7
  VERSION_MAJ ||= 0
8
- VERSION_MIN ||= 2
9
- VERSION_REV ||= 6
8
+ VERSION_MIN ||= 3
9
+ VERSION_REV ||= 0
10
10
 
11
11
  VERSION ||= "#{VERSION_MAJ}.#{VERSION_MIN}.#{VERSION_REV}"
12
12
  end
@@ -20,16 +20,16 @@ Gem::Specification.new do |g|
20
20
  g.test_files = `git ls-files spec/*`.split
21
21
  g.files = `git ls-files`.split
22
22
 
23
- g.add_development_dependency 'rake', '~>10.1', '>= 10.1.0'
24
- g.add_development_dependency 'rspec', '>= 3.0.0.beta2 '
25
- g.add_development_dependency 'rubocop', '~> 0.21', '>= 0.21.0'
26
- g.add_development_dependency 'fuubar', '~> 1.3', '>= 1.3.2'
27
- g.add_development_dependency 'simplecov', '~> 0.8', '>= 0.8.2'
28
- g.add_development_dependency 'coveralls', '~> 0.7', '>= 0.7.0'
29
- g.add_development_dependency 'awesome_print', '~> 1.2', '>= 1.2.0'
23
+ g.add_development_dependency 'rake', '~> 10.1'
24
+ g.add_development_dependency 'rspec', '~> 3.0'
25
+ g.add_development_dependency 'rubocop', '~> 0.23.0'
26
+ g.add_development_dependency 'fuubar', '>= 2.0.0.rc1'
27
+ g.add_development_dependency 'simplecov', '~> 0.8'
28
+ g.add_development_dependency 'coveralls', '~> 0.7'
29
+ g.add_development_dependency 'awesome_print', '~> 1.2'
30
30
 
31
31
  g.add_runtime_dependency 'tzinfo-data'
32
- g.add_runtime_dependency 'tzinfo', '~> 1.1', '>= 1.1.0'
33
- g.add_runtime_dependency 'httparty', '~> 0.12', '>= 0.12.0'
32
+ g.add_runtime_dependency 'tzinfo', '~> 1.1'
33
+ g.add_runtime_dependency 'httparty', '~> 0.12'
34
34
  g.add_runtime_dependency 'gamespy_query', '~> 0.1', '>= 0.1.5'
35
35
  end
@@ -1,5 +1,4 @@
1
1
  # -*- coding: UTF-8 -*-
2
- require 'stringio'
3
2
 
4
3
  describe RMuh::RPT::Log::Fetch do
5
4
  let(:url) do
@@ -86,12 +85,12 @@ describe RMuh::RPT::Log::Fetch do
86
85
  end
87
86
 
88
87
  context '#log' do
89
- it 'should return a StringIO object' do
90
- expect(fetch.log).to be_an_instance_of StringIO
88
+ it 'should return an Array object' do
89
+ expect(fetch.log).to be_an_instance_of Array
91
90
  end
92
91
 
93
92
  it 'should return the log' do
94
- expect(fetch.log.read).to eql "RSpec, yo\n"
93
+ expect(fetch.log.join('')).to eql 'RSpec, yo'
95
94
  end
96
95
  end
97
96
 
@@ -4,6 +4,44 @@ require 'spec_helper'
4
4
  describe RMuh::RPT::Log::Formatters::UnitedOperationsLog do
5
5
  let(:uolog) { RMuh::RPT::Log::Formatters::UnitedOperationsLog }
6
6
 
7
+ describe '.logtime' do
8
+ context 'when given more than two args' do
9
+ it 'should raise ArgumentError' do
10
+ expect do
11
+ uolog.send(:ltime, nil, nil, nil)
12
+ end.to raise_error ArgumentError
13
+ end
14
+ end
15
+
16
+ context 'when given less than one arg' do
17
+ it 'should raise ArgumentError' do
18
+ expect do
19
+ uolog.send(:ltime, nil)
20
+ end.to raise_error ArgumentError
21
+ end
22
+ end
23
+
24
+ context 'when given an event for a message event' do
25
+ let(:event) { { iso8601: '1970-01-01T00:00:00Z' } }
26
+
27
+ subject { uolog.send(:ltime, event, :m) }
28
+
29
+ it { should be_an_instance_of String }
30
+
31
+ it { should eql '1970-01-01T00:00:00Z Server: ' }
32
+ end
33
+
34
+ context 'when given an event for a chat event' do
35
+ let(:event) { { iso8601: '1970-01-01T00:00:00Z' } }
36
+
37
+ subject { uolog.send(:ltime, event, :c) }
38
+
39
+ it { should be_an_instance_of String }
40
+
41
+ it { should eql '1970-01-01T00:00:00Z Chat: ' }
42
+ end
43
+ end
44
+
7
45
  describe '.format_chat' do
8
46
  context 'when given more than one arg' do
9
47
  it 'should raise ArgumentError' do
@@ -33,6 +71,12 @@ describe RMuh::RPT::Log::Formatters::UnitedOperationsLog do
33
71
 
34
72
  it { should be_an_instance_of String }
35
73
 
74
+ it 'should call .time() with the proper args' do
75
+ expect(uolog).to receive(:ltime).with(event, :c)
76
+ .and_return('1970-01-01T00:00:00Z Chat: ')
77
+ subject
78
+ end
79
+
36
80
  it do
37
81
  should eql "1970-01-01T00:00:00Z Chat: (group) Heckman: Seriously?\n"
38
82
  end
@@ -67,6 +111,12 @@ describe RMuh::RPT::Log::Formatters::UnitedOperationsLog do
67
111
 
68
112
  it { should be_an_instance_of String }
69
113
 
114
+ it 'should call .time() with the proper args' do
115
+ expect(uolog).to receive(:ltime).with(event, :m)
116
+ .and_return('z Server: ')
117
+ subject
118
+ end
119
+
70
120
  it { should eql "z Server: Verified GUID (x) of player #0 y\n" }
71
121
  end
72
122
  end
@@ -99,6 +149,12 @@ describe RMuh::RPT::Log::Formatters::UnitedOperationsLog do
99
149
 
100
150
  it { should be_an_instance_of String }
101
151
 
152
+ it 'should call .time() with the proper args' do
153
+ expect(uolog).to receive(:ltime).with(event, :m)
154
+ .and_return('z Server: ')
155
+ subject
156
+ end
157
+
102
158
  it { should eql "z Server: Player x disconnected\n" }
103
159
  end
104
160
  end
@@ -131,6 +187,12 @@ describe RMuh::RPT::Log::Formatters::UnitedOperationsLog do
131
187
 
132
188
  it { should be_an_instance_of String }
133
189
 
190
+ it 'should call .time() with the proper args' do
191
+ expect(uolog).to receive(:ltime).with(event, :m)
192
+ .and_return('z Server: ')
193
+ subject
194
+ end
195
+
134
196
  it { should eql "z Server: Player #0 x (127.0.0.1) connected\n" }
135
197
  end
136
198
  end
@@ -1,13 +1,12 @@
1
1
  # -*- coding: UTF-8 -*-
2
- require 'stringio'
3
2
 
4
3
  describe RMuh::RPT::Log::Parsers::Base do
5
- let(:text) { StringIO.new("This is a string.\nSo is this!") }
4
+ let(:text) { ['This is a string.', 'So is this!'] }
6
5
  let(:base) { RMuh::RPT::Log::Parsers::Base.new }
7
6
 
8
7
  context 'text' do
9
- it 'should be a StringIO object' do
10
- expect(text).to be_an_instance_of StringIO
8
+ it 'should be a Array object' do
9
+ expect(text).to be_an_instance_of Array
11
10
  end
12
11
  end
13
12
 
@@ -48,16 +47,12 @@ describe RMuh::RPT::Log::Parsers::Base do
48
47
  expect { base.parse(0.0) }.to raise_error ArgumentError
49
48
  end
50
49
 
51
- it 'should raise an error when passed an Array' do
52
- expect { base.parse([]) }.to raise_error ArgumentError
53
- end
54
-
55
50
  it 'should raise an error when passed a Hash' do
56
51
  expect { base.parse({}) }.to raise_error ArgumentError
57
52
  end
58
53
 
59
- it 'should not raise an error when passed a StringIO object' do
60
- expect { base.parse(StringIO.new) }.to_not raise_error
54
+ it 'should not raise an error when passed a Array object' do
55
+ expect { base.parse([]) }.to_not raise_error
61
56
  end
62
57
 
63
58
  it 'should return an Array' do
@@ -1,5 +1,4 @@
1
1
  # -*- coding: UTF-8 -*-
2
- require 'stringio'
3
2
  require 'tzinfo'
4
3
 
5
4
  describe RMuh::RPT::Log::Parsers::UnitedOperationsLog do
@@ -286,7 +285,7 @@ describe RMuh::RPT::Log::Parsers::UnitedOperationsLog do
286
285
  "6:58:25 BattlEye Server: (Side) Major Lee Payne: I'm up, " \
287
286
  "radio doesn't work"
288
287
  end
289
- let(:loglines) { StringIO.new("#{guid_line}\n#{chat_line}\n") }
288
+ let(:loglines) { ["#{guid_line}", "#{chat_line}"] }
290
289
 
291
290
  it 'should take no more than one arg' do
292
291
  expect do
@@ -301,7 +300,7 @@ describe RMuh::RPT::Log::Parsers::UnitedOperationsLog do
301
300
  end
302
301
 
303
302
  it 'should return an Array' do
304
- expect(uolog.send(:regex_matches, StringIO.new))
303
+ expect(uolog.send(:regex_matches, []))
305
304
  .to be_an_instance_of Array
306
305
  end
307
306
 
@@ -312,30 +311,30 @@ describe RMuh::RPT::Log::Parsers::UnitedOperationsLog do
312
311
  end
313
312
 
314
313
  it 'should properly match a guid line' do
315
- x = uolog.send(:regex_matches, StringIO.new(guid_line))
314
+ x = uolog.send(:regex_matches, [guid_line])
316
315
  expect(x[0][:type]).to eql :beguid
317
316
  end
318
317
 
319
318
  it 'should properly match a chat line' do
320
- x = uolog.send(:regex_matches, StringIO.new(chat_line))
319
+ x = uolog.send(:regex_matches, [chat_line])
321
320
  expect(x[0][:type]).to eql :chat
322
321
  end
323
322
 
324
323
  it 'should not match a chat line if chat matching is disabled' do
325
324
  u = RMuh::RPT::Log::Parsers::UnitedOperationsLog.new
326
325
  expect(
327
- u.send(:regex_matches, StringIO.new(chat_line)).empty?
326
+ u.send(:regex_matches, [chat_line]).empty?
328
327
  ).to be_truthy
329
328
  end
330
329
 
331
330
  it 'should compact the Array' do
332
- l = StringIO.new("Something1\nSomething2\n")
331
+ l = ['Something1', 'Something2']
333
332
  x = uolog.send(:regex_matches, l)
334
333
  expect(x.include?(nil)).to be_falsey
335
334
  end
336
335
 
337
336
  it 'should call #line_modifiers' do
338
- x = uolog.send(:regex_matches, StringIO.new(guid_line))
337
+ x = uolog.send(:regex_matches, [guid_line])
339
338
  expect(x[0].key?(:year)).to be_truthy
340
339
  expect(x[0].key?(:month)).to be_truthy
341
340
  expect(x[0].key?(:day)).to be_truthy
@@ -359,8 +358,8 @@ describe RMuh::RPT::Log::Parsers::UnitedOperationsLog do
359
358
  expect { uolog.parse }.to raise_error ArgumentError
360
359
  end
361
360
 
362
- it 'should not fail if arg1 is a StringIO object' do
363
- expect { uolog.parse(StringIO.new) }.to_not raise_error
361
+ it 'should not fail if arg1 is a Array object' do
362
+ expect { uolog.parse([]) }.to_not raise_error
364
363
  end
365
364
 
366
365
  it 'should fail if arg1 is a String' do
@@ -379,10 +378,6 @@ describe RMuh::RPT::Log::Parsers::UnitedOperationsLog do
379
378
  expect { uolog.parse(0.0) }.to raise_error ArgumentError
380
379
  end
381
380
 
382
- it 'should fail if arg1 is a Array' do
383
- expect { uolog.parse([]) }.to raise_error ArgumentError
384
- end
385
-
386
381
  it 'should fail if arg1 is a Hash' do
387
382
  expect { uolog.parse({}) }.to raise_error ArgumentError
388
383
  end
@@ -392,11 +387,11 @@ describe RMuh::RPT::Log::Parsers::UnitedOperationsLog do
392
387
  end
393
388
 
394
389
  it 'should return an Array' do
395
- expect(uolog.parse(StringIO.new)).to be_an_instance_of Array
390
+ expect(uolog.parse([])).to be_an_instance_of Array
396
391
  end
397
392
 
398
393
  it 'should call #regex_matches' do
399
- x = uolog.parse(StringIO.new(guid_line))
394
+ x = uolog.parse([guid_line])
400
395
  expect(x[0].key?(:type)).to be_truthy
401
396
  expect(x[0].key?(:year)).to be_truthy
402
397
  expect(x[0].key?(:month)).to be_truthy
@@ -1,5 +1,4 @@
1
1
  # -*- coding: UTF-8 -*-
2
- require 'stringio'
3
2
 
4
3
  describe RMuh::RPT::Log::Parsers::UnitedOperationsRPT do
5
4
  let(:uorpt) { RMuh::RPT::Log::Parsers::UnitedOperationsRPT.new }
@@ -213,7 +212,7 @@ describe RMuh::RPT::Log::Parsers::UnitedOperationsRPT do
213
212
  '0.0015564] (GRID 0655306961). Yevgeniy Nikolayev position: ' \
214
213
  '[6498.62,6916.71,0.0204163] (GRID 0649806916). Distance between:' \
215
214
  ' 71.1653 meters. Near players (100m): None."'
216
- StringIO.new("#{l1}\n#{l2}")
215
+ ["#{l1}", "#{l2}"]
217
216
  end
218
217
 
219
218
  it 'should not take more than one arg' do
@@ -228,14 +227,14 @@ describe RMuh::RPT::Log::Parsers::UnitedOperationsRPT do
228
227
  end.to raise_error ArgumentError
229
228
  end
230
229
 
231
- it 'should fail if arg 1 is not an instance of StringIO' do
230
+ it 'should fail if arg 1 is not an instance of Array' do
232
231
  expect do
233
232
  uorpt.parse(nil)
234
233
  end.to raise_error ArgumentError
235
234
  end
236
235
 
237
236
  it 'should return an Array' do
238
- ll = StringIO.new
237
+ ll = []
239
238
  x = uorpt.parse(ll)
240
239
  expect(x).to be_an_instance_of Array
241
240
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rmuh
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Heckman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-25 00:00:00.000000000 Z
11
+ date: 2014-06-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -17,9 +17,6 @@ dependencies:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '10.1'
20
- - - ">="
21
- - !ruby/object:Gem::Version
22
- version: 10.1.0
23
20
  type: :development
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
@@ -27,63 +24,48 @@ dependencies:
27
24
  - - "~>"
28
25
  - !ruby/object:Gem::Version
29
26
  version: '10.1'
30
- - - ">="
31
- - !ruby/object:Gem::Version
32
- version: 10.1.0
33
27
  - !ruby/object:Gem::Dependency
34
28
  name: rspec
35
29
  requirement: !ruby/object:Gem::Requirement
36
30
  requirements:
37
- - - ">="
31
+ - - "~>"
38
32
  - !ruby/object:Gem::Version
39
- version: 3.0.0.beta2
33
+ version: '3.0'
40
34
  type: :development
41
35
  prerelease: false
42
36
  version_requirements: !ruby/object:Gem::Requirement
43
37
  requirements:
44
- - - ">="
38
+ - - "~>"
45
39
  - !ruby/object:Gem::Version
46
- version: 3.0.0.beta2
40
+ version: '3.0'
47
41
  - !ruby/object:Gem::Dependency
48
42
  name: rubocop
49
43
  requirement: !ruby/object:Gem::Requirement
50
44
  requirements:
51
45
  - - "~>"
52
46
  - !ruby/object:Gem::Version
53
- version: '0.21'
54
- - - ">="
55
- - !ruby/object:Gem::Version
56
- version: 0.21.0
47
+ version: 0.23.0
57
48
  type: :development
58
49
  prerelease: false
59
50
  version_requirements: !ruby/object:Gem::Requirement
60
51
  requirements:
61
52
  - - "~>"
62
53
  - !ruby/object:Gem::Version
63
- version: '0.21'
64
- - - ">="
65
- - !ruby/object:Gem::Version
66
- version: 0.21.0
54
+ version: 0.23.0
67
55
  - !ruby/object:Gem::Dependency
68
56
  name: fuubar
69
57
  requirement: !ruby/object:Gem::Requirement
70
58
  requirements:
71
- - - "~>"
72
- - !ruby/object:Gem::Version
73
- version: '1.3'
74
59
  - - ">="
75
60
  - !ruby/object:Gem::Version
76
- version: 1.3.2
61
+ version: 2.0.0.rc1
77
62
  type: :development
78
63
  prerelease: false
79
64
  version_requirements: !ruby/object:Gem::Requirement
80
65
  requirements:
81
- - - "~>"
82
- - !ruby/object:Gem::Version
83
- version: '1.3'
84
66
  - - ">="
85
67
  - !ruby/object:Gem::Version
86
- version: 1.3.2
68
+ version: 2.0.0.rc1
87
69
  - !ruby/object:Gem::Dependency
88
70
  name: simplecov
89
71
  requirement: !ruby/object:Gem::Requirement
@@ -91,9 +73,6 @@ dependencies:
91
73
  - - "~>"
92
74
  - !ruby/object:Gem::Version
93
75
  version: '0.8'
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- version: 0.8.2
97
76
  type: :development
98
77
  prerelease: false
99
78
  version_requirements: !ruby/object:Gem::Requirement
@@ -101,9 +80,6 @@ dependencies:
101
80
  - - "~>"
102
81
  - !ruby/object:Gem::Version
103
82
  version: '0.8'
104
- - - ">="
105
- - !ruby/object:Gem::Version
106
- version: 0.8.2
107
83
  - !ruby/object:Gem::Dependency
108
84
  name: coveralls
109
85
  requirement: !ruby/object:Gem::Requirement
@@ -111,9 +87,6 @@ dependencies:
111
87
  - - "~>"
112
88
  - !ruby/object:Gem::Version
113
89
  version: '0.7'
114
- - - ">="
115
- - !ruby/object:Gem::Version
116
- version: 0.7.0
117
90
  type: :development
118
91
  prerelease: false
119
92
  version_requirements: !ruby/object:Gem::Requirement
@@ -121,9 +94,6 @@ dependencies:
121
94
  - - "~>"
122
95
  - !ruby/object:Gem::Version
123
96
  version: '0.7'
124
- - - ">="
125
- - !ruby/object:Gem::Version
126
- version: 0.7.0
127
97
  - !ruby/object:Gem::Dependency
128
98
  name: awesome_print
129
99
  requirement: !ruby/object:Gem::Requirement
@@ -131,9 +101,6 @@ dependencies:
131
101
  - - "~>"
132
102
  - !ruby/object:Gem::Version
133
103
  version: '1.2'
134
- - - ">="
135
- - !ruby/object:Gem::Version
136
- version: 1.2.0
137
104
  type: :development
138
105
  prerelease: false
139
106
  version_requirements: !ruby/object:Gem::Requirement
@@ -141,9 +108,6 @@ dependencies:
141
108
  - - "~>"
142
109
  - !ruby/object:Gem::Version
143
110
  version: '1.2'
144
- - - ">="
145
- - !ruby/object:Gem::Version
146
- version: 1.2.0
147
111
  - !ruby/object:Gem::Dependency
148
112
  name: tzinfo-data
149
113
  requirement: !ruby/object:Gem::Requirement
@@ -165,9 +129,6 @@ dependencies:
165
129
  - - "~>"
166
130
  - !ruby/object:Gem::Version
167
131
  version: '1.1'
168
- - - ">="
169
- - !ruby/object:Gem::Version
170
- version: 1.1.0
171
132
  type: :runtime
172
133
  prerelease: false
173
134
  version_requirements: !ruby/object:Gem::Requirement
@@ -175,9 +136,6 @@ dependencies:
175
136
  - - "~>"
176
137
  - !ruby/object:Gem::Version
177
138
  version: '1.1'
178
- - - ">="
179
- - !ruby/object:Gem::Version
180
- version: 1.1.0
181
139
  - !ruby/object:Gem::Dependency
182
140
  name: httparty
183
141
  requirement: !ruby/object:Gem::Requirement
@@ -185,9 +143,6 @@ dependencies:
185
143
  - - "~>"
186
144
  - !ruby/object:Gem::Version
187
145
  version: '0.12'
188
- - - ">="
189
- - !ruby/object:Gem::Version
190
- version: 0.12.0
191
146
  type: :runtime
192
147
  prerelease: false
193
148
  version_requirements: !ruby/object:Gem::Requirement
@@ -195,9 +150,6 @@ dependencies:
195
150
  - - "~>"
196
151
  - !ruby/object:Gem::Version
197
152
  version: '0.12'
198
- - - ">="
199
- - !ruby/object:Gem::Version
200
- version: 0.12.0
201
153
  - !ruby/object:Gem::Dependency
202
154
  name: gamespy_query
203
155
  requirement: !ruby/object:Gem::Requirement