zircon 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: 33918b006b4a91ec126de5c6d06a028d07ba64b8
4
+ data.tar.gz: 45c1aea67b5f1c289efdc3142158dc6a9821de30
5
+ !binary "U0hBNTEy":
6
+ metadata.gz: 17d91c8d7efa7a7daa5bac9463312f33b7238f3130bb8362236fe209ab3df0f048f0907f48274a4335a1e76de0d7ab4cc1a78c1c6e49b9a2429f9a5a7f922f99
7
+ data.tar.gz: 5d121e65035c4469bd0ef1195012d37815f2352ab27a1fa907bd87a39e36eab62515b62b7d1d1ffae5bab6d1532ae48a4a18c0e0664dfe0edbd2bf808af34648
data/README.md CHANGED
@@ -33,3 +33,28 @@ end
33
33
 
34
34
  client.run!
35
35
  ```
36
+
37
+ ## Features
38
+ IRC has following commands.
39
+
40
+ ```
41
+ ADMIN KICK MOTD QUIT VERSION
42
+ AWAY KNOCK NAMES RULES VHOST
43
+ CREDITS LICENSE NICK SETNAME WATCH
44
+ CYCLE LINKS NOTICE SILENCE WHO
45
+ DALINFO LIST PART STATS WHOIS
46
+ INVITE LUSERS PING TIME WHOWAS
47
+ ISON MAP PONG TOPIC USER
48
+ JOIN MODE PASS USERHOST PRIVMSG
49
+ ```
50
+
51
+ You can use sender and receiver methods for each commands.
52
+
53
+ ```
54
+ # For example about PRIVMSG
55
+ # [sender - privmsg]
56
+ privmsg("#channel", ":Hello")
57
+
58
+ # [receiver - on_privmsg]
59
+ on_privmsg {|message| puts message.body }
60
+ ```
@@ -56,6 +56,7 @@ class Zircon
56
56
  WHO
57
57
  WHOIS
58
58
  WHOWAS
59
+ NUMERICREPLY
59
60
  ].freeze
60
61
 
61
62
  def initialize(args = {})
@@ -80,8 +81,6 @@ class Zircon
80
81
  end
81
82
  end
82
83
 
83
- private
84
-
85
84
  def login
86
85
  pass @password if @password
87
86
  nick @nickname
@@ -100,6 +99,8 @@ class Zircon
100
99
  end
101
100
  end
102
101
 
102
+ private
103
+
103
104
  def command(*args)
104
105
  write(args * " " + "\r\n")
105
106
  end
@@ -7,7 +7,10 @@ class Zircon
7
7
  private
8
8
 
9
9
  def method_missing(method_name, *args, &block)
10
- if method_name =~ /(list|on|trigger)_([a-z0-9]+)/
10
+ case method_name
11
+ when /(list|on|trigger)_([0-9]+)/
12
+ send($1, 'numericreply', *args, &block)
13
+ when /(list|on|trigger)_([a-z0-9]+)/
11
14
  send($1, $2, *args, &block)
12
15
  else
13
16
  super
@@ -1,3 +1,3 @@
1
1
  class Zircon
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -28,4 +28,29 @@ describe Zircon do
28
28
  Zircon.new.privmsg("channel", ":message")
29
29
  end
30
30
  end
31
+
32
+ describe "Callback for numeric reply" do
33
+ let(:callback) do
34
+ proc {|msg|}
35
+ end
36
+
37
+ let(:zircon) do
38
+ Zircon.new
39
+ end
40
+
41
+ before do
42
+ zircon.on_numericreply(&callback)
43
+ end
44
+
45
+ context "when triggered event name is number" do
46
+ let(:event) do
47
+ 345
48
+ end
49
+
50
+ it "should be called" do
51
+ callback.should_receive(:call).with('message')
52
+ zircon.send("trigger_#{event}", 'message')
53
+ end
54
+ end
55
+ end
31
56
  end
metadata CHANGED
@@ -1,27 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zircon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
5
- prerelease:
4
+ version: 0.0.5
6
5
  platform: ruby
7
6
  authors:
8
7
  - Ryo NAKAMURA
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-09-23 00:00:00.000000000 Z
11
+ date: 2013-02-11 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rspec
16
- requirement: &70277967925220 !ruby/object:Gem::Requirement
17
- none: false
15
+ requirement: !ruby/object:Gem::Requirement
18
16
  requirements:
19
- - - ! '>='
17
+ - - ">="
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :development
23
21
  prerelease: false
24
- version_requirements: *70277967925220
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
25
27
  description: Zircon is a mineral belonging to the group of nesosilicates.
26
28
  email:
27
29
  - r7kamura@gmail.com
@@ -29,7 +31,7 @@ executables: []
29
31
  extensions: []
30
32
  extra_rdoc_files: []
31
33
  files:
32
- - .gitignore
34
+ - ".gitignore"
33
35
  - Gemfile
34
36
  - LICENSE
35
37
  - README.md
@@ -44,29 +46,27 @@ files:
44
46
  - zircon.gemspec
45
47
  homepage: https://github.com/r7kamura/zircon
46
48
  licenses: []
49
+ metadata: {}
47
50
  post_install_message:
48
51
  rdoc_options: []
49
52
  require_paths:
50
53
  - lib
51
54
  required_ruby_version: !ruby/object:Gem::Requirement
52
- none: false
53
55
  requirements:
54
- - - ! '>='
56
+ - - ">="
55
57
  - !ruby/object:Gem::Version
56
58
  version: '0'
57
59
  required_rubygems_version: !ruby/object:Gem::Requirement
58
- none: false
59
60
  requirements:
60
- - - ! '>='
61
+ - - ">="
61
62
  - !ruby/object:Gem::Version
62
63
  version: '0'
63
64
  requirements: []
64
65
  rubyforge_project:
65
- rubygems_version: 1.8.15
66
+ rubygems_version: 2.0.0.preview3
66
67
  signing_key:
67
- specification_version: 3
68
+ specification_version: 4
68
69
  summary: IRC client library written in Pure Ruby
69
70
  test_files:
70
71
  - spec/spec_helper.rb
71
72
  - spec/zircon_spec.rb
72
- has_rdoc: