ramaze 2008.06 → 2008.11

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.
Files changed (184) hide show
  1. data/README.markdown +6 -6
  2. data/Rakefile +33 -3
  3. data/bin/ramaze +18 -0
  4. data/doc/CHANGELOG +960 -0
  5. data/doc/LEGAL +5 -1
  6. data/doc/meta/announcement.txt +20 -36
  7. data/doc/tutorial/todolist.html +421 -313
  8. data/doc/tutorial/todolist.mkd +33 -16
  9. data/examples/app/blog/spec/blog.rb +3 -3
  10. data/examples/app/rapaste/controller/paste.rb +8 -1
  11. data/examples/app/rapaste/model/paste.rb +3 -0
  12. data/examples/app/rapaste/spec/rapaste.rb +3 -1
  13. data/examples/app/rapaste/start.rb +3 -2
  14. data/examples/app/sourceview/public/sourceview.js +2 -2
  15. data/examples/app/todolist/spec/todolist.rb +6 -6
  16. data/examples/app/todolist/template/index.xhtml +1 -1
  17. data/examples/app/whywiki/spec/whywiki.rb +2 -2
  18. data/examples/app/wikore/spec/wikore.rb +2 -2
  19. data/examples/app/wikore/src/model.rb +4 -3
  20. data/examples/app/wiktacular/spec/wiktacular.rb +7 -7
  21. data/examples/basic/simple.rb +2 -2
  22. data/examples/helpers/paginate.rb +71 -0
  23. data/examples/misc/simple_auth.rb +20 -8
  24. data/lib/proto/controller/init.rb +10 -0
  25. data/lib/proto/controller/main.rb +1 -3
  26. data/lib/proto/model/init.rb +4 -0
  27. data/lib/proto/public/dispatch.fcgi +1 -1
  28. data/lib/proto/spec/main.rb +2 -1
  29. data/lib/proto/start.rb +3 -3
  30. data/lib/proto/start.ru +1 -1
  31. data/lib/proto/view/error.xhtml +4 -4
  32. data/lib/ramaze.rb +8 -3
  33. data/lib/ramaze/action.rb +6 -6
  34. data/lib/ramaze/adapter.rb +1 -6
  35. data/lib/ramaze/adapter/base.rb +30 -27
  36. data/lib/ramaze/adapter/cgi.rb +1 -0
  37. data/lib/ramaze/cache.rb +1 -3
  38. data/lib/ramaze/cache/memcached.rb +3 -5
  39. data/lib/ramaze/contrib/auto_params.rb +2 -2
  40. data/lib/ramaze/contrib/auto_params/get_args.rb +2 -1
  41. data/lib/ramaze/contrib/gems.rb +17 -18
  42. data/lib/ramaze/contrib/gzip_filter.rb +22 -9
  43. data/lib/ramaze/contrib/maruku_uv.rb +59 -0
  44. data/lib/ramaze/contrib/profiling.rb +1 -1
  45. data/lib/ramaze/contrib/rest.rb +16 -13
  46. data/lib/ramaze/contrib/sequel/create_join.rb +25 -0
  47. data/lib/ramaze/contrib/sequel/form_field.rb +129 -0
  48. data/lib/ramaze/contrib/sequel/image.rb +198 -0
  49. data/lib/ramaze/contrib/sequel/relation.rb +82 -0
  50. data/lib/ramaze/controller.rb +33 -34
  51. data/lib/ramaze/controller/resolve.rb +29 -9
  52. data/lib/ramaze/current.rb +60 -20
  53. data/lib/ramaze/current/request.rb +8 -7
  54. data/lib/ramaze/current/response.rb +15 -3
  55. data/lib/ramaze/current/session/flash.rb +8 -0
  56. data/lib/ramaze/dispatcher.rb +17 -9
  57. data/lib/ramaze/dispatcher/action.rb +4 -5
  58. data/lib/ramaze/dispatcher/directory.rb +1 -1
  59. data/lib/ramaze/dispatcher/error.rb +4 -4
  60. data/lib/ramaze/dispatcher/file.rb +4 -4
  61. data/lib/ramaze/gestalt.rb +15 -20
  62. data/lib/ramaze/helper/cgi.rb +7 -15
  63. data/lib/ramaze/helper/formatting.rb +41 -1
  64. data/lib/ramaze/helper/httpdigest.rb +20 -7
  65. data/lib/ramaze/helper/link.rb +4 -6
  66. data/lib/ramaze/helper/paginate.rb +233 -0
  67. data/lib/ramaze/helper/redirect.rb +1 -1
  68. data/lib/ramaze/helper/rest.rb +1 -1
  69. data/lib/ramaze/helper/thread.rb +17 -0
  70. data/lib/ramaze/helper/ultraviolet.rb +44 -0
  71. data/lib/ramaze/helper/user.rb +4 -9
  72. data/lib/ramaze/log.rb +2 -2
  73. data/lib/ramaze/log/analogger.rb +21 -23
  74. data/lib/ramaze/log/growl.rb +21 -23
  75. data/lib/ramaze/log/hub.rb +1 -1
  76. data/lib/ramaze/log/informer.rb +97 -99
  77. data/lib/ramaze/log/knotify.rb +14 -16
  78. data/lib/ramaze/log/logger.rb +11 -13
  79. data/lib/ramaze/log/logging.rb +61 -63
  80. data/lib/ramaze/log/rotatinginformer.rb +168 -0
  81. data/lib/ramaze/log/syslog.rb +41 -31
  82. data/lib/ramaze/log/xosd.rb +70 -72
  83. data/lib/ramaze/option.rb +9 -6
  84. data/lib/ramaze/option/holder.rb +5 -27
  85. data/lib/ramaze/reloader.rb +186 -0
  86. data/lib/ramaze/setup.rb +1 -1
  87. data/lib/ramaze/snippets.rb +13 -0
  88. data/lib/ramaze/snippets/array/put_within.rb +31 -24
  89. data/lib/ramaze/snippets/binding/locals.rb +23 -11
  90. data/lib/ramaze/snippets/dictionary.rb +2 -2
  91. data/lib/ramaze/snippets/fiber.rb +63 -0
  92. data/lib/ramaze/snippets/kernel/constant.rb +36 -21
  93. data/lib/ramaze/snippets/kernel/pretty_inspect.rb +12 -6
  94. data/lib/ramaze/snippets/numeric/filesize_format.rb +24 -17
  95. data/lib/ramaze/snippets/numeric/time.rb +63 -0
  96. data/lib/ramaze/snippets/object/__dir__.rb +29 -0
  97. data/lib/ramaze/snippets/object/acquire.rb +40 -0
  98. data/lib/ramaze/snippets/object/instance_variable_defined.rb +16 -5
  99. data/lib/ramaze/snippets/object/pretty.rb +14 -4
  100. data/lib/ramaze/snippets/object/scope.rb +14 -7
  101. data/lib/ramaze/snippets/ordered_set.rb +25 -14
  102. data/lib/ramaze/snippets/proc/locals.rb +17 -9
  103. data/lib/ramaze/snippets/ramaze/deprecated.rb +13 -0
  104. data/lib/ramaze/snippets/ramaze/fiber.rb +24 -0
  105. data/lib/ramaze/snippets/ramaze/state.rb +86 -0
  106. data/lib/ramaze/snippets/ramaze/struct.rb +45 -0
  107. data/lib/ramaze/snippets/string/camel_case.rb +13 -8
  108. data/lib/ramaze/snippets/string/color.rb +24 -20
  109. data/lib/ramaze/snippets/string/each.rb +14 -3
  110. data/lib/ramaze/snippets/string/end_with.rb +20 -0
  111. data/lib/ramaze/snippets/string/esc.rb +26 -21
  112. data/lib/ramaze/snippets/string/ord.rb +12 -6
  113. data/lib/ramaze/snippets/string/snake_case.rb +13 -7
  114. data/lib/ramaze/snippets/string/start_with.rb +16 -5
  115. data/lib/ramaze/snippets/string/unindent.rb +23 -15
  116. data/lib/ramaze/snippets/thread/into.rb +3 -3
  117. data/lib/ramaze/spec/helper/bacon.rb +5 -5
  118. data/lib/ramaze/spec/helper/mock_http.rb +1 -1
  119. data/lib/ramaze/spec/helper/pretty_output.rb +2 -2
  120. data/lib/ramaze/spec/helper/snippets.rb +8 -0
  121. data/lib/ramaze/template.rb +4 -1
  122. data/lib/ramaze/template/ezamar/textpow.syntax +34 -0
  123. data/lib/ramaze/template/maruku.rb +34 -0
  124. data/lib/ramaze/template/tagz.rb +2 -2
  125. data/lib/ramaze/template/xslt.rb +2 -2
  126. data/lib/ramaze/tool/create.rb +27 -53
  127. data/lib/ramaze/tool/localize.rb +8 -4
  128. data/lib/ramaze/tool/mime.rb +11 -1
  129. data/lib/ramaze/tool/project_creator.rb +110 -0
  130. data/lib/ramaze/trinity.rb +4 -1
  131. data/lib/ramaze/version.rb +1 -1
  132. data/lib/vendor/bacon.rb +323 -0
  133. data/rake_tasks/gem.rake +10 -1
  134. data/rake_tasks/maintenance.rake +40 -2
  135. data/rake_tasks/metric.rake +24 -0
  136. data/rake_tasks/release.rake +17 -4
  137. data/rake_tasks/spec.rake +1 -2
  138. data/ramaze.gemspec +549 -495
  139. data/spec/contrib/auto_params.rb +3 -3
  140. data/spec/contrib/profiling.rb +2 -2
  141. data/spec/examples/simple_auth.rb +2 -2
  142. data/spec/examples/templates/template_haml.rb +0 -2
  143. data/spec/ramaze/action/file_cache.rb +22 -0
  144. data/spec/ramaze/adapter.rb +2 -2
  145. data/spec/ramaze/controller/actionless_templates.rb +1 -1
  146. data/spec/ramaze/controller/subclass.rb +15 -0
  147. data/spec/ramaze/controller/template_resolving.rb +1 -1
  148. data/spec/ramaze/controller/view/bar.xhtml +1 -0
  149. data/spec/ramaze/controller/view/base/another.xhtml +1 -0
  150. data/spec/ramaze/current/session.rb +1 -1
  151. data/spec/ramaze/dispatcher/file.rb +2 -2
  152. data/spec/ramaze/helper/aspect.rb +26 -17
  153. data/spec/ramaze/helper/formatting.rb +13 -0
  154. data/spec/ramaze/log/informer.rb +10 -10
  155. data/spec/ramaze/log/syslog.rb +67 -4
  156. data/spec/ramaze/rewrite.rb +1 -1
  157. data/spec/ramaze/route.rb +1 -1
  158. data/spec/ramaze/struct.rb +47 -0
  159. data/spec/ramaze/template/markaby.rb +1 -1
  160. data/spec/ramaze/template/tagz.rb +1 -1
  161. data/spec/snippets/binding/locals.rb +9 -0
  162. data/spec/snippets/numeric/time.rb +12 -0
  163. data/spec/snippets/{kernel → object}/__dir__.rb +0 -0
  164. data/spec/snippets/{kernel → object}/acquire.rb +0 -0
  165. metadata +90 -81
  166. data/cache.yaml +0 -7
  167. data/examples/app/rammit/spec/rammit.rb +0 -31
  168. data/examples/app/rammit/src/controller/main.rb +0 -3
  169. data/examples/app/rammit/src/controller/page.rb +0 -16
  170. data/examples/app/rammit/src/model.rb +0 -33
  171. data/examples/app/rammit/start.rb +0 -8
  172. data/examples/app/rammit/template/index.xhtml +0 -14
  173. data/examples/app/rammit/template/page/view.xhtml +0 -4
  174. data/lib/ramaze/snippets/kernel/__dir__.rb +0 -23
  175. data/lib/ramaze/snippets/kernel/acquire.rb +0 -34
  176. data/lib/ramaze/snippets/object/thread_accessor.rb +0 -5
  177. data/lib/ramaze/snippets/ramaze/thread_accessor.rb +0 -58
  178. data/lib/ramaze/snippets/struct/fill.rb +0 -23
  179. data/lib/ramaze/snippets/struct/values_at.rb +0 -39
  180. data/lib/ramaze/snippets/symbol/to_proc.rb +0 -24
  181. data/lib/ramaze/sourcereload.rb +0 -176
  182. data/spec/snippets/struct/fill.rb +0 -26
  183. data/spec/snippets/struct/values_at.rb +0 -52
  184. data/spec/snippets/symbol/to_proc.rb +0 -13
@@ -1,26 +1,41 @@
1
1
  # Copyright (c) 2008 Michael Fellinger m.fellinger@gmail.com
2
2
  # All files in this distribution are subject to the terms of the Ruby license.
3
3
 
4
- # Extensions for Kernel
5
-
6
- module Kernel
7
- # Original from Trans (Facets 1.4.5)
8
- # This is similar to +Module#const_get+ but is accessible at all levels,
9
- # and, unlike +const_get+, can handle module hierarchy.
10
- #
11
- # constant("Fixnum") # -> Fixnum
12
- # constant(:Fixnum) # -> Fixnum
13
- #
14
- # constant("Process::Sys") # -> Process::Sys
15
- # constant("Regexp::MULTILINE") # -> 4
16
- #
17
- # require 'test/unit'
18
- # Test.constant("Unit::Assertions") # -> Test::Unit::Assertions
19
- # Test.constant("::Test::Unit") # -> Test::Unit
20
-
21
- def constant(const)
22
- const = const.to_s.dup
23
- base = const.sub!(/^::/, '') ? Object : ( self.kind_of?(Module) ? self : self.class )
24
- const.split(/::/).inject(base){ |mod, name| mod.const_get(name) }
4
+ module Ramaze
5
+ module CoreExtensions
6
+
7
+ # Extensions for Kernel
8
+
9
+ module Object
10
+
11
+ # Original from Trans (Facets 1.4.5)
12
+ # This is similar to +Module#const_get+ but is accessible at all levels,
13
+ # and, unlike +const_get+, can handle module hierarchy.
14
+ #
15
+ # constant("Fixnum") # -> Fixnum
16
+ # constant(:Fixnum) # -> Fixnum
17
+ #
18
+ # constant("Process::Sys") # -> Process::Sys
19
+ # constant("Regexp::MULTILINE") # -> 4
20
+ #
21
+ # require 'test/unit'
22
+ # Test.constant("Unit::Assertions") # -> Test::Unit::Assertions
23
+ # Test.constant("::Test::Unit") # -> Test::Unit
24
+
25
+ def constant(const)
26
+ const = const.to_s.dup
27
+
28
+ if const.sub!(/^::/, '')
29
+ base = Object
30
+ elsif self.kind_of?(Module)
31
+ base = self
32
+ else
33
+ base = self.class
34
+ end
35
+
36
+ const.split(/::/).inject(base){ |mod, name| mod.const_get(name) }
37
+ end
38
+ end
39
+
25
40
  end
26
41
  end
@@ -3,13 +3,19 @@
3
3
 
4
4
  require 'pp'
5
5
 
6
- # Extensions for Kernel
6
+ module Ramaze
7
+ module CoreExtensions
7
8
 
8
- module Kernel
9
- unless defined?(pretty_inspect)
10
- # returns a pretty printed object as a string.
11
- def pretty_inspect
12
- PP.pp(self, '')
9
+ # Extensions for Kernel
10
+
11
+ module Kernel
12
+ unless defined?(pretty_inspect)
13
+ # returns a pretty printed object as a string.
14
+ def pretty_inspect
15
+ PP.pp(self, '')
16
+ end
17
+ end
13
18
  end
19
+
14
20
  end
15
21
  end
@@ -1,25 +1,32 @@
1
1
  # Copyright (c) 2008 Michael Fellinger m.fellinger@gmail.com
2
2
  # All files in this distribution are subject to the terms of the Ruby license.
3
3
 
4
- class Numeric
5
- FILESIZE_FORMAT = [
6
- ['%.1fT', 1 << 40],
7
- ['%.1fG', 1 << 30],
8
- ['%.1fM', 1 << 20],
9
- ['%.1fK', 1 << 10],
10
- ]
4
+ module Ramaze
5
+ module CoreExtensions
11
6
 
12
- # Output this number as easily readable filesize.
13
- # Usage:
14
- # 100_000.filesize_format # => "97.7K"
15
- # 100_000_000.filesize_format # => "95.4M"
16
- # 100_000_000_000.filesize_format # => "93.1G"
17
- # 100_000_000_000_000.filesize_format # => "90.9T"
18
- def filesize_format
19
- FILESIZE_FORMAT.each do |format, size|
20
- return format % (self.to_f / size) if self >= size
7
+ # Extensions for Numeric
8
+ module Numeric
9
+ FILESIZE_FORMAT = [
10
+ ['%.1fT', 1 << 40],
11
+ ['%.1fG', 1 << 30],
12
+ ['%.1fM', 1 << 20],
13
+ ['%.1fK', 1 << 10],
14
+ ]
15
+
16
+ # Output this number as easily readable filesize.
17
+ # Usage:
18
+ # 100_000.filesize_format # => "97.7K"
19
+ # 100_000_000.filesize_format # => "95.4M"
20
+ # 100_000_000_000.filesize_format # => "93.1G"
21
+ # 100_000_000_000_000.filesize_format # => "90.9T"
22
+ def filesize_format
23
+ FILESIZE_FORMAT.each do |format, size|
24
+ return format % (self.to_f / size) if self >= size
25
+ end
26
+
27
+ self.to_s
28
+ end
21
29
  end
22
30
 
23
- self.to_s
24
31
  end
25
32
  end
@@ -0,0 +1,63 @@
1
+ module Ramaze
2
+ module CoreExtensions
3
+
4
+ # Extensions for Numeric
5
+
6
+ module Numeric
7
+ def seconds
8
+ self
9
+ end
10
+ alias second seconds
11
+
12
+ # 60 seconds in a minute
13
+ def minutes
14
+ self * 60
15
+ end
16
+ alias minute minutes
17
+
18
+ # 60 minutes in an hour
19
+ def hours
20
+ self * 3600
21
+ end
22
+ alias hour hours
23
+
24
+ # 24 hours in a day
25
+ def days
26
+ self * 86400
27
+ end
28
+ alias day days
29
+
30
+ # 7 days in a week
31
+ def weeks
32
+ self * 604800
33
+ end
34
+ alias week weeks
35
+
36
+ # 30 days in a month
37
+ def months
38
+ self * 2592000
39
+ end
40
+ alias month months
41
+
42
+ # 365.25 days in a year
43
+ def years
44
+ self * 883612800
45
+ end
46
+ alias year years
47
+
48
+ # Time in the past, i.e. 3.days.ago
49
+ def ago t = Time.now
50
+ t - self
51
+ end
52
+ alias before ago
53
+
54
+ # Time in the future, i.e. 3.days.from_now
55
+ def from_now t = Time.now
56
+ t + self
57
+ end
58
+ alias since from_now
59
+
60
+ end
61
+
62
+ end
63
+ end
@@ -0,0 +1,29 @@
1
+ # Copyright (c) 2008 Michael Fellinger m.fellinger@gmail.com
2
+ # All files in this distribution are subject to the terms of the Ruby license.
3
+
4
+ module Ramaze
5
+ module CoreExtensions
6
+
7
+ # Extensions for Object
8
+
9
+ module Object
10
+ unless defined?(__DIR__)
11
+
12
+ # This is similar to +__FILE__+ and +__LINE__+, and returns a String
13
+ # representing the directory of the current file is.
14
+ # Unlike +__FILE__+ the path returned is absolute.
15
+ #
16
+ # This method is convenience for the
17
+ # File.expand_path(File.dirname(__FILE__))
18
+ # idiom.
19
+ #
20
+
21
+ def __DIR__()
22
+ filename = caller[0][/^(.*):/, 1]
23
+ File.expand_path(File.dirname(filename))
24
+ end
25
+ end
26
+ end
27
+
28
+ end
29
+ end
@@ -0,0 +1,40 @@
1
+ # Copyright (c) 2008 Michael Fellinger m.fellinger@gmail.com
2
+ # All files in this distribution are subject to the terms of the Ruby license.
3
+
4
+ module Ramaze
5
+ module CoreExtensions
6
+
7
+ # Extensions for Kernel
8
+
9
+ module Object
10
+
11
+ # Require all .rb and .so files on the given globs, utilizes Dir::[].
12
+ #
13
+ # Examples:
14
+ # # Given following directory structure:
15
+ # # src/foo.rb
16
+ # # src/bar.so
17
+ # # src/foo.yaml
18
+ # # src/foobar/baz.rb
19
+ # # src/foobar/README
20
+ #
21
+ # # requires all files in 'src':
22
+ # acquire 'src/*'
23
+ #
24
+ # # requires all files in 'src' recursive:
25
+ # acquire 'src/**/*'
26
+ #
27
+ # # require 'src/foo.rb' and 'src/bar.so' and 'src/foobar/baz.rb'
28
+ # acquire 'src/*', 'src/foobar/*'
29
+
30
+ def acquire *globs
31
+ globs.flatten.each do |glob|
32
+ Dir[glob].each do |file|
33
+ require file if file =~ /\.(rb|so)$/
34
+ end
35
+ end
36
+ end
37
+ end
38
+
39
+ end
40
+ end
@@ -1,8 +1,19 @@
1
- class Object
2
- # Available in 1.8.6 and later.
3
- unless method_defined?(:instance_variable_defined?)
4
- def instance_variable_defined?(variable)
5
- instance_variables.include?(variable.to_s)
1
+ # Copyright (c) 2008 Michael Fellinger m.fellinger@gmail.com
2
+ # All files in this distribution are subject to the terms of the Ruby license.
3
+
4
+ module Ramaze
5
+ module CoreExtensions
6
+
7
+ # Extensions for Object
8
+ module Object
9
+ # Available in 1.8.6 and later.
10
+
11
+ unless ::Object.method_defined?(:instance_variable_defined?)
12
+ def instance_variable_defined?(variable)
13
+ instance_variables.include?(variable.to_s)
14
+ end
15
+ end
6
16
  end
17
+
7
18
  end
8
19
  end
@@ -1,6 +1,16 @@
1
- class Object
2
- def pretty s = ''
3
- PP.pp(self, s)
4
- s
1
+ module Ramaze
2
+ module CoreExtensions
3
+
4
+ # Extensions for Object
5
+ module Object
6
+
7
+ # Returns the string that #pretty_inspect would yield
8
+
9
+ def pretty s = ''
10
+ PP.pp(self, s)
11
+ s
12
+ end
13
+ end
14
+
5
15
  end
6
16
  end
@@ -1,11 +1,18 @@
1
- class Object
1
+ module Ramaze
2
+ module CoreExtensions
2
3
 
3
- # returns a new clean binding for this object
4
- # usage: eval 'self', object.scope #=> returns object
5
- #
4
+ # Extensions for Object
5
+ module Object
6
6
 
7
- def scope
8
- lambda{}
9
- end
7
+ # returns a new clean binding for this object
8
+ # usage: eval 'self', object.scope #=> returns object
9
+ #
10
+
11
+ def scope
12
+ lambda{}
13
+ end
10
14
 
15
+ end
16
+
17
+ end
11
18
  end
@@ -5,6 +5,10 @@ require(File.join(File.dirname(__FILE__), 'blankslate'))
5
5
 
6
6
  # Basically an Set, but with Order, ain't that obivous?
7
7
  class OrderedSet < BlankSlate
8
+ def self.[](*args)
9
+ new(*args)
10
+ end
11
+
8
12
  # Create new instances, optionally pass the first set
9
13
  def initialize(*args)
10
14
  if args.size == 1
@@ -18,23 +22,30 @@ class OrderedSet < BlankSlate
18
22
  @set.uniq!
19
23
  end
20
24
 
25
+ %w[ push unshift << ].each do |meth|
26
+ class_eval %[
27
+ def #{meth} *args
28
+ @set.delete(*args)
29
+ @set.#{meth}(*args)
30
+ end
31
+ ]
32
+ end
33
+
34
+ def []= *args
35
+ @set.map! do |e|
36
+ if ::Array === args.last
37
+ args.last.include?(e) ? nil : e
38
+ else
39
+ args.last == e ? nil : e
40
+ end
41
+ end
42
+ @set.__send__(:[]=, *args)
43
+ @set.compact!
44
+ end
45
+
21
46
  # Delegate everything, but controlled, keep elements unique.
22
47
  # Warning, this is not really atomic.
23
48
  def method_missing(meth, *args, &block)
24
- case meth.to_s
25
- when /push|unshift|\<\</
26
- @set.delete(*args)
27
- when '[]='
28
- @set.map! do |e|
29
- if ::Array === args.last
30
- args.last.include?(e) ? nil : e
31
- else
32
- args.last == e ? nil : e
33
- end
34
- end
35
- end
36
49
  @set.__send__(meth, *args, &block)
37
- ensure
38
- @set.compact! if meth == :[]=
39
50
  end
40
51
  end
@@ -1,11 +1,19 @@
1
- class Proc
2
-
3
- # returns a hash of localvar/localvar-values from proc, useful for template
4
- # engines that do not accept bindings/proc and force passing locals via
5
- # hash
6
- # usage: x = 42; p Proc.new.locals #=> {'x'=> 42}
7
- def locals
8
- instance_eval('binding').locals
9
- end
1
+ module Ramaze
2
+ module CoreExtensions
3
+
4
+ # Extensions for Proc
5
+
6
+ module Proc
10
7
 
8
+ # returns a hash of localvar/localvar-values from proc, useful for template
9
+ # engines that do not accept bindings/proc and force passing locals via
10
+ # hash
11
+ # usage: x = 42; p Proc.new.locals #=> {'x'=> 42}
12
+
13
+ def locals
14
+ instance_eval('binding').locals
15
+ end
16
+
17
+ end
18
+ end
11
19
  end
@@ -1,7 +1,20 @@
1
1
  module Ramaze
2
+ DEPRECATED_CONSTANTS = {
3
+ :ThreadAccessor => :StateAccessor
4
+ }
5
+
2
6
  def self.deprecated(from, to = nil)
3
7
  message = "%s is deprecated"
4
8
  message << ", use %s instead" unless to.nil?
5
9
  Log.warn(message % [from, to])
6
10
  end
11
+
12
+ def self.const_missing(name)
13
+ if to = DEPRECATED_CONSTANTS[name]
14
+ Log.warn "Ramaze::#{name} is deprecated, use #{to} instead"
15
+ constant(to)
16
+ else
17
+ super
18
+ end
19
+ end
7
20
  end