caesars 0.7.1 → 0.7.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES.txt CHANGED
@@ -1,6 +1,17 @@
1
1
  CAESARS -- CHANGES
2
2
 
3
3
 
4
+ #### 0.7.2 (2009-06-13) ###############################
5
+
6
+ * FIXED: Caesars::Hash method missing now correctly returns
7
+ hash values for element keys which are Strings.
8
+ * ADDED: Caesars::Hash.__class__ method which returns
9
+ one of: Hash (Ruby 1.9) or Caesars::OrderedHash (Ruby 1.8)
10
+ * CHANGE: All arguments to forced_hash methods now reference
11
+ the value of the first argument. They were previously
12
+ ignored but now mimic the default behavior.
13
+
14
+
4
15
  #### 0.7.1 (2009-06-08) ###############################
5
16
 
6
17
  * FIXED: Updated file manifest in gemspec
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.7.1"
4
+ s.version = "0.7.2"
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
@@ -13,7 +13,7 @@ class Caesars
13
13
  require 'caesars/exceptions'
14
14
  require 'caesars/config'
15
15
 
16
- VERSION = "0.7.1"
16
+ VERSION = "0.7.2"
17
17
  @@debug = false
18
18
  @@chilled = {}
19
19
  @@forced_array = {}
@@ -249,6 +249,7 @@ class Caesars
249
249
  # previously) and also in subclasses of Caesars for returning the appropriate
250
250
  # attribute values.
251
251
  def method_missing(meth, *args, &b)
252
+ STDERR.puts "Caesars.method_missing: #{meth}" if Caesars.debug?
252
253
  add_known_symbol(meth)
253
254
  if Caesars.forced_ignore?(meth)
254
255
  STDERR.puts "Forced ignore: #{meth}" if Caesars.debug?
@@ -355,6 +356,7 @@ class Caesars
355
356
  module_eval %Q{
356
357
  def #{caesars_meth}(*caesars_names,&b)
357
358
  this_meth = :'#{caesars_meth}'
359
+
358
360
  add_known_symbol(this_meth)
359
361
  if Caesars.forced_ignore?(this_meth)
360
362
  STDERR.puts "Forced ignore: \#{this_meth}" if Caesars.debug?
@@ -368,11 +370,12 @@ class Caesars
368
370
  return nil if caesars_names.empty? && b.nil?
369
371
  return method_missing(this_meth, *caesars_names, &b) if caesars_names.empty?
370
372
 
371
- # TODO: This should be a loop
373
+ # Take the first argument in the list provided to "caesars_meth"
372
374
  caesars_name = caesars_names.shift
373
375
 
374
376
  prev = @caesars_pointer
375
377
  @caesars_pointer[this_meth] ||= Caesars::Hash.new
378
+
376
379
  hash = Caesars::Hash.new
377
380
  if @caesars_pointer[this_meth].has_key?(caesars_name)
378
381
  STDERR.puts "duplicate key ignored: \#{caesars_name}"
@@ -400,8 +403,14 @@ class Caesars
400
403
  @caesars_pointer = prev
401
404
  @caesars_pointer[this_meth][caesars_name] = hash
402
405
  end
403
-
404
- @caesars_pointer = prev
406
+
407
+ # All other arguments provided to "caesars_meth"
408
+ # will reference the value for the first argument.
409
+ caesars_names.each do |name|
410
+ @caesars_pointer[this_meth][name] = @caesars_pointer[this_meth][caesars_name]
411
+ end
412
+
413
+ @caesars_pointer = prev # Make sure we're back up one level
405
414
  end
406
415
  }
407
416
  nil
data/lib/caesars/hash.rb CHANGED
@@ -6,8 +6,10 @@
6
6
  #
7
7
  class Caesars
8
8
  class Hash < HASH_TYPE
9
+
9
10
  def method_missing(meth)
10
- self[meth] if self.has_key?(meth)
11
+ STDERR.puts "Caesars::Hash.method_missing: #{meth}" if Caesars.debug?
12
+ self[meth] || self[meth.to_s]
11
13
  end
12
14
 
13
15
  # Returns a clone of itself and all children cast as ::Hash objects
@@ -26,6 +28,10 @@ class Caesars
26
28
  end
27
29
  target
28
30
  end
29
-
31
+
32
+ def __class__
33
+ HASH_TYPE
34
+ end
35
+
30
36
  end
31
37
  end
@@ -158,9 +158,6 @@ class Caesars::OrderedHash < ::Hash
158
158
  def class
159
159
  Hash
160
160
  end
161
- def __class__
162
- Caesars::OrderedHash
163
- end
164
161
 
165
162
  attr_accessor "to_yaml_style"
166
163
  def yaml_inline= bool
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.7.1
4
+ version: 0.7.2
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-06-08 00:00:00 -04:00
12
+ date: 2009-06-13 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies: []
15
15