muby 0.7.12 → 0.7.13

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.
@@ -13,4 +13,5 @@ require "muby/connection"
13
13
  require "muby/help"
14
14
  require "muby/completer"
15
15
  require "muby/application"
16
+ require "muby/trigger"
16
17
 
@@ -4,7 +4,7 @@ require 'ncurses'
4
4
  module Muby
5
5
 
6
6
 
7
- VERSION = "0.7.12" unless defined?(Muby::VERSION)
7
+ VERSION = "0.7.13" unless defined?(Muby::VERSION)
8
8
 
9
9
  #
10
10
  # The class that encapsulates all configuration.
@@ -11,7 +11,7 @@ module Muby
11
11
 
12
12
  def do_execute(command, *args)
13
13
  result = nil
14
- if Proc === command
14
+ if command.respond_to?(:call)
15
15
  result = command.call(*args[0...(command.arity)])
16
16
  elsif String === command
17
17
  result = eval(command)
@@ -0,0 +1,37 @@
1
+
2
+ module Muby
3
+
4
+ class Trigger
5
+
6
+ class Shot
7
+ attr_accessor :inwin, :outwin, :match, :trigger
8
+ def initialize(trigger, inwin, outwin, match)
9
+ @inwin = inwin
10
+ @outinw = outwin
11
+ @match = match
12
+ @trigger = trigger
13
+ end
14
+ def remove!
15
+ @trigger.remove!
16
+ end
17
+ end
18
+
19
+ attr_accessor :regexp, :block, :type
20
+ def initialize(type, regexp, &block)
21
+ @regexp = regexp
22
+ @block = block
23
+ @type = type
24
+ conf.send("#{@type}_triggers".to_sym)[@regexp] = self
25
+ end
26
+ def arity
27
+ 3
28
+ end
29
+ def call(inwin, outwin, match)
30
+ block.call(Shot.new(self, inwin, outwin, match))
31
+ end
32
+ def remove!
33
+ conf.send("#{@type}_triggers".to_sym).delete(@regexp)
34
+ end
35
+ end
36
+
37
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: muby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.12
4
+ version: 0.7.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Kihlgren, Sy Ali
@@ -9,12 +9,11 @@ autorequire: muby
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-09-27 00:00:00 +02:00
12
+ date: 2008-09-30 00:00:00 +02:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: ncurses
17
- type: :runtime
18
17
  version_requirement:
19
18
  version_requirements: !ruby/object:Gem::Requirement
20
19
  requirements:
@@ -31,21 +30,21 @@ extensions: []
31
30
  extra_rdoc_files: []
32
31
 
33
32
  files:
34
- - lib/muby/completer.rb
35
- - lib/muby/configuration.rb
36
33
  - lib/muby/connection.rb
37
- - lib/muby/displayer.rb
38
- - lib/muby/help.rb
39
- - lib/muby/inputwindow.rb
40
34
  - lib/muby/logger.rb
41
- - lib/muby/outputwindow.rb
42
35
  - lib/muby/style.rb
43
36
  - lib/muby/user_methods.rb
44
- - lib/muby/application.rb
45
37
  - lib/muby/helper_methods.rb
38
+ - lib/muby/application.rb
46
39
  - lib/muby/user_window.rb
40
+ - lib/muby/configuration.rb
41
+ - lib/muby/inputwindow.rb
42
+ - lib/muby/help.rb
43
+ - lib/muby/outputwindow.rb
44
+ - lib/muby/completer.rb
45
+ - lib/muby/displayer.rb
46
+ - lib/muby/trigger.rb
47
47
  - lib/muby.rb
48
- - contrib/sy/cce.rb
49
48
  - contrib/aardmud.org_4000/aliases/aard-aliases.rb
50
49
  - contrib/aardmud.org_4000/gags/aard-gags.rb
51
50
  - contrib/aardmud.org_4000/speedwalks/aard-sw-areas-vidblain.rb
@@ -66,6 +65,7 @@ files:
66
65
  - contrib/aardmud.org_4000/misc/aard_consider_substitutions.rb
67
66
  - contrib/aardmud.org_4000/aard-helpers.rb
68
67
  - contrib/aardmud.org_4000/aard-config.rb
68
+ - contrib/sy/cce.rb
69
69
  - contrib/aardmud.org_4000/README.txt
70
70
  - LICENSE
71
71
  has_rdoc: true
@@ -91,7 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
91
91
  requirements: []
92
92
 
93
93
  rubyforge_project:
94
- rubygems_version: 1.2.0
94
+ rubygems_version: 1.1.1
95
95
  signing_key:
96
96
  specification_version: 2
97
97
  summary: A simple but powerful mud client.