holywarez-mpt 0.1.3.7 → 0.1.3.8
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.
- data/CHANGELOG +1 -0
- data/install_gem.bat +1 -1
- data/lib/event.rb +31 -31
- data/mpt.gemspec +4 -4
- metadata +3 -3
data/CHANGELOG
CHANGED
data/install_gem.bat
CHANGED
data/lib/event.rb
CHANGED
|
@@ -1,4 +1,32 @@
|
|
|
1
1
|
|
|
2
|
+
class Array
|
|
3
|
+
def mpt_filterchain_reorganize
|
|
4
|
+
index = 0
|
|
5
|
+
while index < self.size
|
|
6
|
+
filter = self[index]
|
|
7
|
+
filter_opts = filter[:options]
|
|
8
|
+
unless filter_opts[:after].nil?
|
|
9
|
+
for i in index..self.size-1
|
|
10
|
+
fo = self[i][:options]
|
|
11
|
+
unless fo[:as].nil?
|
|
12
|
+
if fo[:as] == filter_opts[:after]
|
|
13
|
+
new_chain = []
|
|
14
|
+
new_chain += self[0..index-1] if index > 0
|
|
15
|
+
new_chain += [self[i]]
|
|
16
|
+
new_chain += self[index..i-1]
|
|
17
|
+
new_chain += self[i+1..self.size-1]
|
|
18
|
+
self.replace new_chain
|
|
19
|
+
index = 0
|
|
20
|
+
break
|
|
21
|
+
end # if :as matched with :after
|
|
22
|
+
end # unless :as is nil
|
|
23
|
+
end # for next items
|
|
24
|
+
end # unless :after is nil
|
|
25
|
+
index += 1
|
|
26
|
+
end # while index < list size
|
|
27
|
+
end # def reorganize
|
|
28
|
+
end # filter chain class
|
|
29
|
+
|
|
2
30
|
module MPT
|
|
3
31
|
class EventContainer
|
|
4
32
|
attr_accessor :event_object
|
|
@@ -9,42 +37,14 @@ module MPT
|
|
|
9
37
|
|
|
10
38
|
end
|
|
11
39
|
|
|
12
|
-
class FilterChain < Array
|
|
13
|
-
def reorganize
|
|
14
|
-
index = 0
|
|
15
|
-
while index < self.size
|
|
16
|
-
filter = self[index]
|
|
17
|
-
filter_opts = filter[:options]
|
|
18
|
-
unless filter_opts[:after].nil?
|
|
19
|
-
for i in index..self.size-1
|
|
20
|
-
fo = self[i][:options]
|
|
21
|
-
unless fo[:as].nil?
|
|
22
|
-
if fo[:as] == filter_opts[:after]
|
|
23
|
-
new_chain = []
|
|
24
|
-
new_chain += self[0..index-1] if index > 0
|
|
25
|
-
new_chain += [self[i]]
|
|
26
|
-
new_chain += self[index..i-1]
|
|
27
|
-
new_chain += self[i+1..self.size-1]
|
|
28
|
-
self.replace new_chain
|
|
29
|
-
index = 0
|
|
30
|
-
break
|
|
31
|
-
end # if :as matched with :after
|
|
32
|
-
end # unless :as is nil
|
|
33
|
-
end # for next items
|
|
34
|
-
end # unless :after is nil
|
|
35
|
-
index += 1
|
|
36
|
-
end # while index < list size
|
|
37
|
-
end # def reorganize
|
|
38
|
-
end # filter chain class
|
|
39
|
-
|
|
40
40
|
class Event
|
|
41
41
|
@@mpt_subscribers = {}
|
|
42
42
|
|
|
43
43
|
class << self
|
|
44
44
|
def subscribe(event_name, options = {}, &block)
|
|
45
|
-
channel = @@mpt_subscribers[event_name] ||=
|
|
45
|
+
channel = @@mpt_subscribers[event_name] ||= []
|
|
46
46
|
channel << { :options => options, :proc => block }
|
|
47
|
-
channel.
|
|
47
|
+
channel.mpt_filterchain_reorganize
|
|
48
48
|
end
|
|
49
49
|
|
|
50
50
|
def trigger_with_object(event_name, object, *args)
|
|
@@ -70,7 +70,7 @@ module MPT
|
|
|
70
70
|
|
|
71
71
|
def clear_owner_subscribers(owner)
|
|
72
72
|
@@mpt_subscribers.each_pair do |event_name, subscribers|
|
|
73
|
-
@@mpt_subscribers[event_name] =
|
|
73
|
+
@@mpt_subscribers[event_name] = subscribers.select { |s| owner != s[:options][:owner] }
|
|
74
74
|
end
|
|
75
75
|
end
|
|
76
76
|
end # end of static section
|
data/mpt.gemspec
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Gem::Specification.new do |s|
|
|
4
4
|
s.name = %q{mpt}
|
|
5
|
-
s.version = "0.1.3.
|
|
5
|
+
s.version = "0.1.3.8"
|
|
6
6
|
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
|
8
8
|
s.authors = ["Anatoly Lapshin"]
|
|
9
|
-
s.date = %q{2009-
|
|
9
|
+
s.date = %q{2009-08-02}
|
|
10
10
|
s.description = %q{Monkey Patching Toolkit}
|
|
11
11
|
s.email = %q{}
|
|
12
12
|
s.extra_rdoc_files = ["CHANGELOG", "lib/event.rb", "lib/mpt.rb", "lib/system.rb", "lib/wrap.rb", "LICENSE", "README"]
|
|
@@ -16,12 +16,12 @@ Gem::Specification.new do |s|
|
|
|
16
16
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Mpt", "--main", "README"]
|
|
17
17
|
s.require_paths = ["lib"]
|
|
18
18
|
s.rubyforge_project = %q{mpt}
|
|
19
|
-
s.rubygems_version = %q{1.3.
|
|
19
|
+
s.rubygems_version = %q{1.3.1}
|
|
20
20
|
s.summary = %q{Monkey Patching Toolkit}
|
|
21
21
|
|
|
22
22
|
if s.respond_to? :specification_version then
|
|
23
23
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
|
24
|
-
s.specification_version =
|
|
24
|
+
s.specification_version = 2
|
|
25
25
|
|
|
26
26
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
|
27
27
|
s.add_runtime_dependency(%q<activesupport>, [">= 0"])
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: holywarez-mpt
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.3.
|
|
4
|
+
version: 0.1.3.8
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Anatoly Lapshin
|
|
@@ -9,7 +9,7 @@ autorequire:
|
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
11
|
|
|
12
|
-
date: 2009-
|
|
12
|
+
date: 2009-08-02 00:00:00 -07:00
|
|
13
13
|
default_executable:
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
@@ -96,7 +96,7 @@ requirements: []
|
|
|
96
96
|
rubyforge_project: mpt
|
|
97
97
|
rubygems_version: 1.3.5
|
|
98
98
|
signing_key:
|
|
99
|
-
specification_version:
|
|
99
|
+
specification_version: 2
|
|
100
100
|
summary: Monkey Patching Toolkit
|
|
101
101
|
test_files: []
|
|
102
102
|
|