caesars 0.6.7 → 0.6.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/CHANGES.txt +5 -0
- data/caesars.gemspec +1 -1
- data/lib/caesars.rb +46 -18
- metadata +2 -2
data/CHANGES.txt
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
CAESARS -- CHANGES
|
2
2
|
|
3
3
|
|
4
|
+
#### 0.6.8 (2009-06-01) ###############################
|
5
|
+
|
6
|
+
* ADDED: forced_array elements now store blocks as Procs (they were previously ignored)
|
7
|
+
* ADDED: drill to test the new forced_array functionality.
|
8
|
+
|
4
9
|
#### 0.6.7 (2009-05-23) ###############################
|
5
10
|
|
6
11
|
* FIXED: Bug in inherited when calling from an anonymous class
|
data/caesars.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
@spec = Gem::Specification.new do |s|
|
2
2
|
s.name = "caesars"
|
3
3
|
s.rubyforge_project = "caesars"
|
4
|
-
s.version = "0.6.
|
4
|
+
s.version = "0.6.8"
|
5
5
|
s.specification_version = 1 if s.respond_to? :specification_version=
|
6
6
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
7
7
|
|
data/lib/caesars.rb
CHANGED
@@ -314,27 +314,43 @@ class Caesars
|
|
314
314
|
end
|
315
315
|
|
316
316
|
if b
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
317
|
+
if Caesars.forced_array?(meth)
|
318
|
+
@caesars_pointer[meth] ||= []
|
319
|
+
args << b # Forced array blocks are always chilled and at the end
|
320
|
+
@caesars_pointer[meth] << args
|
321
|
+
else
|
322
|
+
# We loop through each of the arguments sent to "meth".
|
323
|
+
# Elements are added for each of the arguments and the
|
324
|
+
# contents of the block will be applied to each one.
|
325
|
+
# This is an important feature for Rudy configs since
|
326
|
+
# it allows defining several environments, roles, etc
|
327
|
+
# at the same time.
|
328
|
+
# env :dev, :stage, :prod do
|
329
|
+
# ...
|
330
|
+
# end
|
331
|
+
|
332
|
+
# Use the name of the method if no name is supplied.
|
333
|
+
args << meth if args.empty?
|
334
|
+
|
335
|
+
args.each do |name|
|
336
|
+
prev = @caesars_pointer
|
337
|
+
@caesars_pointer[name] ||= Caesars::Hash.new
|
338
|
+
if Caesars.chilled?(meth)
|
339
|
+
@caesars_pointer[name] = b
|
340
|
+
else
|
341
|
+
@caesars_pointer = @caesars_pointer[name]
|
342
|
+
begin
|
343
|
+
b.call if b
|
344
|
+
rescue ArgumentError, SyntaxError => ex
|
345
|
+
STDERR.puts "CAESARS: error in #{meth} (#{args.join(', ')})"
|
346
|
+
raise ex
|
347
|
+
end
|
348
|
+
@caesars_pointer = prev
|
332
349
|
end
|
333
|
-
@caesars_pointer = prev
|
334
350
|
end
|
335
351
|
end
|
336
|
-
|
337
|
-
# We've seen this attribute before, add the
|
352
|
+
|
353
|
+
# We've seen this attribute before, add the value to the existing element
|
338
354
|
elsif @caesars_pointer.kind_of?(Hash) && @caesars_pointer[meth]
|
339
355
|
|
340
356
|
if Caesars.forced_array?(meth)
|
@@ -467,6 +483,18 @@ class Caesars
|
|
467
483
|
#
|
468
484
|
# @food.sauce # => [[:tabasco, :worcester], [:franks]]
|
469
485
|
#
|
486
|
+
# The blocks for elements that are specified as forced_array
|
487
|
+
# will be chilled (stored as Proc objects). The block is put
|
488
|
+
# at the end of the Array. e.g.
|
489
|
+
#
|
490
|
+
# food do
|
491
|
+
# sauce :arg1, :arg2 do
|
492
|
+
# ...
|
493
|
+
# end
|
494
|
+
# end
|
495
|
+
#
|
496
|
+
# @food.sauce # => [[:inline_method, :arg1, :arg2, #<Proc:0x1fa552>]]
|
497
|
+
#
|
470
498
|
def self.forced_array(caesars_meth)
|
471
499
|
STDERR.puts "forced_array: #{caesars_meth}" if Caesars.debug?
|
472
500
|
Caesars.add_known_symbol(self, caesars_meth)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: caesars
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Delano Mandelbaum
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-06-01 00:00:00 -04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|