glue 0.14.0 → 0.15.0
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 +16 -0
- data/README +11 -1
- data/doc/AUTHORS +0 -3
- data/doc/RELEASES +5 -1
- data/lib/glue.rb +2 -2
- data/lib/glue/attribute.rb +2 -1
- data/lib/glue/dynamic_include.rb +42 -0
- data/lib/glue/misc.rb +15 -0
- metadata +3 -2
data/CHANGELOG
CHANGED
@@ -1,5 +1,21 @@
|
|
1
|
+
01-04-2005 George Moschovitis <gm@navel.gr>
|
2
|
+
|
3
|
+
* doc/RELEASES: updated.
|
4
|
+
|
5
|
+
* README: updated.
|
6
|
+
|
7
|
+
31-03-2005 George Moschovitis <gm@navel.gr>
|
8
|
+
|
9
|
+
* lib/glue/dynamic_include.rb: check if append_dynamic exists.
|
10
|
+
|
11
|
+
30-03-2005 George Moschovitis <gm@navel.gr>
|
12
|
+
|
13
|
+
* lib/glue/dynamic_include.rb: MEGACOOL, implemented.
|
14
|
+
|
1
15
|
24-03-2005 George Moschovitis <gm@navel.gr>
|
2
16
|
|
17
|
+
* --- VERSION 0.14.0 ---
|
18
|
+
|
3
19
|
* test/glue/tc_property.rb: added more tests.
|
4
20
|
|
5
21
|
* lib/glue/property.rb (#enchant): moved inheritance code
|
data/README
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
-
= Glue 0.
|
1
|
+
= Glue 0.15.0
|
2
2
|
|
3
3
|
Useful utilites and methods.
|
4
|
+
|
5
|
+
== Licence
|
6
|
+
|
7
|
+
Copyright (c) 2004-2005, George 'tml' Moschovitis.
|
8
|
+
Copyright (c) 2004-2005, Navel Ltd (http://www.navel.gr)
|
9
|
+
|
10
|
+
Glue (http://www.rubyforge.org/projects/nitro) is copyrighted free
|
11
|
+
software created and maintained by George Moschovitis (mailto:gm@navel.gr)
|
12
|
+
and released under the standard BSD Licence. For details consult
|
13
|
+
the file LICENCE.
|
data/doc/AUTHORS
CHANGED
data/doc/RELEASES
CHANGED
data/lib/glue.rb
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
#
|
5
5
|
# George Moschovitis <gm@navel.gr>
|
6
6
|
# (c) 2004-2005 Navel, all rights reserved.
|
7
|
-
# $Id: glue.rb
|
7
|
+
# $Id: glue.rb 340 2005-04-04 08:26:58Z gmosx $
|
8
8
|
|
9
9
|
require 'English'
|
10
10
|
require 'pp'
|
@@ -57,7 +57,7 @@ module Glue
|
|
57
57
|
|
58
58
|
# The version.
|
59
59
|
|
60
|
-
Version = '0.
|
60
|
+
Version = '0.15.0'
|
61
61
|
|
62
62
|
# Library path.
|
63
63
|
|
data/lib/glue/attribute.rb
CHANGED
@@ -13,6 +13,8 @@
|
|
13
13
|
# mattr_accessor :my_attr, 'Default value'
|
14
14
|
#
|
15
15
|
# FIXME: I think those methods do *not* work as expected.
|
16
|
+
# FIXME: I should probably use @-attributes instead of
|
17
|
+
# @@-attributes.
|
16
18
|
#++
|
17
19
|
|
18
20
|
class Module # :nodoc:
|
@@ -20,7 +22,6 @@ class Module # :nodoc:
|
|
20
22
|
def mattr_reader(*params)
|
21
23
|
default = if params.last.is_a?(Symbol) then nil else params.pop end
|
22
24
|
|
23
|
-
|
24
25
|
for sym in params
|
25
26
|
module_eval <<-"end_eval", __FILE__, __LINE__
|
26
27
|
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# Dynamic include
|
2
|
+
#
|
3
|
+
# Allows you to include dyanamic mixins.
|
4
|
+
#
|
5
|
+
# === Example
|
6
|
+
#
|
7
|
+
# module Mixin
|
8
|
+
# def self.append_dynamic_features(base, options)
|
9
|
+
# base.class_eval %{
|
10
|
+
# def hello
|
11
|
+
# puts 'Hello from #{options[:name]}'
|
12
|
+
# end
|
13
|
+
# }
|
14
|
+
# end
|
15
|
+
# end
|
16
|
+
#
|
17
|
+
# class MyClass
|
18
|
+
# include Mixin, :name => 'tml'
|
19
|
+
# end
|
20
|
+
#
|
21
|
+
# m = MyClass.new
|
22
|
+
# m.hello -> 'Hello from tml'
|
23
|
+
#
|
24
|
+
# * George Moschovitis <gm@navel.gr>
|
25
|
+
# (c) 2004-2005 Navel, all rights reserved.
|
26
|
+
# $Id: dynamic_include.rb 338 2005-03-31 16:26:10Z gmosx $
|
27
|
+
|
28
|
+
class Module
|
29
|
+
alias_method :__include_without_options__, :include
|
30
|
+
|
31
|
+
def include(*args)
|
32
|
+
options = args.last.is_a?(Hash) ? args.pop : {}
|
33
|
+
|
34
|
+
for mod in args
|
35
|
+
if mod.respond_to?(:append_dynamic_features)
|
36
|
+
mod.append_dynamic_features(self, options)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
__include_without_options__(*args)
|
41
|
+
end
|
42
|
+
end
|
data/lib/glue/misc.rb
CHANGED
@@ -12,3 +12,18 @@ def silence_warnings
|
|
12
12
|
$VERBOSE = old_verbose
|
13
13
|
end
|
14
14
|
end
|
15
|
+
|
16
|
+
#
|
17
|
+
|
18
|
+
def execution_root
|
19
|
+
for c in caller.reverse
|
20
|
+
path = c.split(':')[-2]
|
21
|
+
|
22
|
+
if path == $0
|
23
|
+
return File.dirname(path)
|
24
|
+
end
|
25
|
+
|
26
|
+
raise 'Cannot find execution root directory'
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.10
|
|
3
3
|
specification_version: 1
|
4
4
|
name: glue
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.
|
7
|
-
date: 2005-
|
6
|
+
version: 0.15.0
|
7
|
+
date: 2005-04-04
|
8
8
|
summary: Glue utilities
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -49,6 +49,7 @@ files:
|
|
49
49
|
- lib/glue/flexob.rb
|
50
50
|
- lib/glue/cache.rb
|
51
51
|
- lib/glue/string.rb
|
52
|
+
- lib/glue/dynamic_include.rb
|
52
53
|
- lib/glue/object.rb
|
53
54
|
- lib/glue/array.rb
|
54
55
|
- lib/glue/validation.rb
|