ircp 1.1.3 → 1.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/ircp/message.rb +3 -2
- data/lib/ircp/prefix.rb +1 -0
- data/lib/ircp/version.rb +1 -1
- data/spec/ircp/message_spec.rb +7 -0
- metadata +5 -5
data/lib/ircp/message.rb
CHANGED
@@ -10,8 +10,9 @@ module Ircp
|
|
10
10
|
options = args.last.is_a?(Hash) ? args.pop : {}
|
11
11
|
@raw = options[:raw]
|
12
12
|
@prefix = options[:prefix] ? Prefix.new(options[:prefix]) : nil
|
13
|
-
@command = options[:command]
|
13
|
+
@command = options[:command] || args.shift
|
14
14
|
@params = args + Array(options[:params])
|
15
|
+
yield self if block_given?
|
15
16
|
end
|
16
17
|
|
17
18
|
def inspect
|
@@ -34,7 +35,7 @@ module Ircp
|
|
34
35
|
end
|
35
36
|
tokens += @params
|
36
37
|
|
37
|
-
msg = tokens.map { |token| token.to_s }
|
38
|
+
msg = tokens.map { |token| token.to_s }.reject { |token| token.empty? }.join(' ')
|
38
39
|
msg << CRLF unless msg.end_with?(CRLF)
|
39
40
|
msg
|
40
41
|
end
|
data/lib/ircp/prefix.rb
CHANGED
data/lib/ircp/version.rb
CHANGED
data/spec/ircp/message_spec.rb
CHANGED
@@ -2,6 +2,13 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Ircp::Message do
|
4
4
|
describe '#initialize' do
|
5
|
+
context 'args' do
|
6
|
+
include_context 'initialize message', 'PASS', 'secretpasswordhere'
|
7
|
+
its(:command) { should eq 'PASS' }
|
8
|
+
it_should_behave_like 'prefix for', nil
|
9
|
+
it_should_behave_like 'params for', 'secretpasswordhere'
|
10
|
+
end
|
11
|
+
|
5
12
|
context 'with args' do
|
6
13
|
include_context 'initialize message', 'secretpasswordhere', :command => 'PASS'
|
7
14
|
its(:command) { should eq 'PASS' }
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ircp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-02-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: treetop
|
@@ -99,7 +99,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
99
99
|
version: '0'
|
100
100
|
segments:
|
101
101
|
- 0
|
102
|
-
hash:
|
102
|
+
hash: -4454188754034219675
|
103
103
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
104
104
|
none: false
|
105
105
|
requirements:
|
@@ -108,10 +108,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
108
108
|
version: '0'
|
109
109
|
segments:
|
110
110
|
- 0
|
111
|
-
hash:
|
111
|
+
hash: -4454188754034219675
|
112
112
|
requirements: []
|
113
113
|
rubyforge_project:
|
114
|
-
rubygems_version: 1.8.
|
114
|
+
rubygems_version: 1.8.24
|
115
115
|
signing_key:
|
116
116
|
specification_version: 3
|
117
117
|
summary: IRC minimal parser for ruby
|