caesars 0.6.3 → 0.6.4

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES.txt CHANGED
@@ -1,6 +1,11 @@
1
1
  CAESARS -- CHANGES
2
2
 
3
3
 
4
+ #### 0.6.4 (2009-05-10) ###############################
5
+
6
+ * CHANGE: OrderedHash support for Ruby 1.8 and JRuby
7
+
8
+
4
9
  #### 0.6.3 (2009-05-04) ###############################
5
10
 
6
11
  * FIXED: Bug in forced_hash, not creating some keys
data/README.rdoc CHANGED
@@ -159,6 +159,7 @@ Or for GitHub fans:
159
159
 
160
160
  == Credits
161
161
 
162
+ * OrderedHash implementation by jan molic
162
163
  * Delano Mandelbaum (delano@solutious.com)
163
164
 
164
165
  == Thanks
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.3"
4
+ s.version = "0.6.4"
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
@@ -1,3 +1,4 @@
1
+ require 'orderedhash'
1
2
 
2
3
  # Caesars -- Rapid DSL prototyping in Ruby.
3
4
  #
@@ -14,6 +15,7 @@ class Caesars
14
15
  @@forced_ignore = {}
15
16
  @@known_symbols = []
16
17
  @@known_symbols_by_glass = {}
18
+ HASH_TYPE = (RUBY_VERSION =~ /1.9/) ? ::Hash : ::OrderedHash
17
19
 
18
20
  def Caesars.enable_debug; @@debug = true; end
19
21
  def Caesars.disable_debug; @@debug = false; end
@@ -60,7 +62,7 @@ class Caesars
60
62
  # ch = Caesars::Hash[:tabasco => :lots!]
61
63
  # puts ch.tabasco # => lots!
62
64
  #
63
- class Hash < ::Hash
65
+ class Hash < HASH_TYPE
64
66
  def method_missing(meth)
65
67
  self[meth] if self.has_key?(meth)
66
68
  end
@@ -68,7 +70,7 @@ class Caesars
68
70
  # Returns a clone of itself and all children cast as ::Hash objects
69
71
  def to_hash(hash=self)
70
72
  return hash unless hash.is_a?(Caesars::Hash) # nothing to do
71
- target = ::Hash[dup]
73
+ target = (Caesars::HASH_TYPE)[dup]
72
74
  hash.keys.each do |key|
73
75
  if hash[key].is_a? Caesars::Hash
74
76
  target[key] = hash[key].to_hash
@@ -571,7 +573,7 @@ class Caesars::Config
571
573
  #
572
574
  def initialize(*args)
573
575
  # We store the options hash b/c we reapply them when we refresh.
574
- @options = args.last.is_a?(Hash) ? args.pop : {}
576
+ @options = args.last.kind_of?(Hash) ? args.pop : {}
575
577
  @paths = args.empty? ? [] : args
576
578
  @options = {}
577
579
  @forced_refreshes = 0
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.3
4
+ version: 0.6.4
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-05-04 00:00:00 -04:00
12
+ date: 2009-05-09 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies: []
15
15