ruby_extensions 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/m_object.rb +10 -1
- data/lib/method_not_implemented.rb +12 -0
- data/lib/tasks/rubyforge_config.yml +1 -1
- metadata +5 -2
data/lib/m_object.rb
CHANGED
@@ -50,7 +50,7 @@ class Object
|
|
50
50
|
|
51
51
|
now it will cache it to @foo_var
|
52
52
|
=end
|
53
|
-
def ivar_cache(var_name = nil
|
53
|
+
def ivar_cache(var_name = nil, &block)
|
54
54
|
if var_name.nil?
|
55
55
|
call = caller[0]
|
56
56
|
var_name = call[(call.index('`')+1)...call.index("'")]
|
@@ -62,6 +62,15 @@ class Object
|
|
62
62
|
instance_variable_get("@#{var_name}")
|
63
63
|
end
|
64
64
|
|
65
|
+
def ivar_cache_clear(var_name = nil, &block)
|
66
|
+
if var_name.nil?
|
67
|
+
call = caller[0]
|
68
|
+
var_name = call[(call.index('`')+1)...call.index("'")]
|
69
|
+
end
|
70
|
+
remove_instance_variable("@#{var_name}") rescue
|
71
|
+
yield if block_given?
|
72
|
+
end
|
73
|
+
|
65
74
|
def namespaces
|
66
75
|
ivar_cache("object_namespaces") do
|
67
76
|
nss = []
|
@@ -0,0 +1,12 @@
|
|
1
|
+
=begin rdoc
|
2
|
+
This exception is thrown if there is a method that has not been implemented that needs to be.
|
3
|
+
=end
|
4
|
+
class MethodNotImplemented < Exception
|
5
|
+
|
6
|
+
def initialize(meth, msg = nil)
|
7
|
+
mess = "#{meth} has not been implemented!\nPlease implement this method!\nIf you do not understand what this method is supposed to do, please consult the RDoc for more information."
|
8
|
+
mess += "\n#{msg}" unless msg.nil?
|
9
|
+
super(mess)
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.2
|
|
3
3
|
specification_version: 1
|
4
4
|
name: ruby_extensions
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 1.0.
|
7
|
-
date: 2007-
|
6
|
+
version: 1.0.2
|
7
|
+
date: 2007-11-09 00:00:00 -05:00
|
8
8
|
summary: ruby_extensions
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -17,6 +17,7 @@ rubyforge_project: magrathea
|
|
17
17
|
description: "ruby_extensions was developed by: markbates"
|
18
18
|
autorequire:
|
19
19
|
- ruby_extensions
|
20
|
+
- method_not_implemented
|
20
21
|
- m_string
|
21
22
|
- m_object
|
22
23
|
- m_math
|
@@ -27,6 +28,7 @@ autorequire:
|
|
27
28
|
- m_class
|
28
29
|
- m_array
|
29
30
|
- ruby_extensions
|
31
|
+
- method_not_implemented
|
30
32
|
- m_string
|
31
33
|
- m_object
|
32
34
|
- m_math
|
@@ -62,6 +64,7 @@ files:
|
|
62
64
|
- lib/m_math.rb
|
63
65
|
- lib/m_object.rb
|
64
66
|
- lib/m_string.rb
|
67
|
+
- lib/method_not_implemented.rb
|
65
68
|
- lib/ruby_extensions.rb
|
66
69
|
- lib/tasks/rubyforge_config.yml
|
67
70
|
test_files: []
|