rhaproxy 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,20 @@
1
+ class Class
2
+ old_include = instance_method(:include)
3
+ define_method(:include) do |*args|
4
+ default = {:alias => {}, :exclude => []}
5
+ hash_arg = (Hash === args.last) ? default.update(args.pop) : default
6
+ m = Module.new
7
+ args.each{|mod| m.module_eval{ include mod } }
8
+ # ^^^^^^^^^^^^^^^
9
+ # check for "method shadowing" here and raise an exception or
10
+ # something if you feel like it
11
+ hash_arg[:alias].each_pair do |old, new|
12
+ m.module_eval{ alias_method(new, old); undef_method(old) }
13
+ end
14
+ excluded = (Array === hash_arg[:exclude]) ? hash_arg[:exclude] : [hash_arg[:exclude]]
15
+ # [*hash_arg[:exclude]] won't work on 1.9 cause there's no Object#to_a
16
+ excluded.each{|meth| m.module_eval { undef_method(meth) } }
17
+ old_include.bind(self).call(m)
18
+ end
19
+ end
20
+
data/lib/rhaproxy.rb CHANGED
@@ -5,5 +5,7 @@
5
5
  # Copyright:: (cc) 2011 Joel Bryan Juliano
6
6
  # License:: MIT
7
7
 
8
+ require File.expand_path(File.dirname(__FILE__) + '/rhaproxy/mixins.rb')
9
+ require File.expand_path(File.dirname(__FILE__) + '/rhaproxy/keywords.rb')
8
10
  Dir[File.join(File.dirname(__FILE__), 'rhaproxy/**/*.rb')].sort.each { |lib| require lib }
9
11
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rhaproxy
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 0
10
- version: 0.1.0
9
+ - 1
10
+ version: 0.1.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Joel Bryan Juliano
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-12-30 00:00:00 +08:00
18
+ date: 2011-01-04 00:00:00 +08:00
19
19
  default_executable:
20
20
  dependencies: []
21
21
 
@@ -43,6 +43,8 @@ files:
43
43
  - lib/rhaproxy/userlist.rb
44
44
  - lib/rhaproxy/peers.rb
45
45
  - lib/rhaproxy/frontend.rb
46
+ - lib/rhaproxy/keywords.rb
47
+ - lib/rhaproxy/mixins.rb
46
48
  has_rdoc: true
47
49
  homepage: http://github.com/jjuliano/rhaproxy
48
50
  licenses: []