caesars 0.6.6 → 0.6.7

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 CHANGED
@@ -1,11 +1,16 @@
1
1
  CAESARS -- CHANGES
2
2
 
3
3
 
4
+ #### 0.6.7 (2009-05-23) ###############################
5
+
6
+ * FIXED: Bug in inherited when calling from an anonymous class
7
+ * ADDED: tryouts/
8
+
4
9
  #### 0.6.6 (2009-05-12) ###############################
5
10
 
6
11
  * CHANGE: Renamed OrderedHash to Caesars::OrderedHash to eliminate change of namespace conflicts
7
12
  * CHANGE: Caesars::VERSION is now a String an includes the TINY (0.6.6)
8
- * FIX: OrderedHash.merge was making an inappropriate call to dup
13
+ * FIXED: OrderedHash.merge was making an inappropriate call to dup
9
14
 
10
15
 
11
16
  #### 0.6.5 (2009-05-10) ###############################
data/bin/example CHANGED
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env ruby
1
+ #!/usr/bin/ruby
2
2
 
3
3
  # Caesars -- A working example
4
4
  #
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.6"
4
+ s.version = "0.6.7"
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
@@ -277,10 +277,10 @@ class Caesars
277
277
  end
278
278
 
279
279
  # Returns the lowercase name of the class. i.e. Some::Taste # => taste
280
- def glass; @glass ||= (self.class.to_s.split(/::/))[-1].downcase.to_sym; end
280
+ def glass; @glass ||= (self.class.to_s.split(/::/)).last.downcase.to_sym; end
281
281
 
282
282
  # Returns the lowercase name of +klass+. i.e. Some::Taste # => taste
283
- def self.glass(klass); (klass.to_s.split(/::/))[-1].downcase.to_sym; end
283
+ def self.glass(klass); (klass.to_s.split(/::/)).last.downcase.to_sym; end
284
284
 
285
285
  # This method handles all of the attributes that are not forced hashes
286
286
  # It's used in the DSL for handling attributes dyanamically (that weren't defined
@@ -506,11 +506,19 @@ class Caesars
506
506
  # end
507
507
  #
508
508
  def self.inherited(modname)
509
+ STDERR.puts "INHERITED: #{modname}" if Caesars.debug?
510
+
509
511
  # NOTE: We may be able to replace this without an eval using Module.nesting
510
- meth = (modname.to_s.split(/::/))[-1].downcase # Some::HighBall => highball
512
+ meth = (modname.to_s.split(/::/)).last.downcase # Some::HighBall => highball
513
+
514
+ # The method name "meth" is now a known symbol
515
+ # for the short class name (also "meth").
511
516
  Caesars.add_known_symbol(meth, meth)
512
- module_eval %Q{
513
- module #{modname}::DSL
517
+
518
+ # We execute a module_eval form the namespace of the inherited class
519
+ # so when we define the new module DSL it will be Some::HighBall::DSL.
520
+ modname.module_eval %Q{
521
+ module DSL
514
522
  def #{meth}(*args, &b)
515
523
  name = !args.empty? ? args.first.to_s : nil
516
524
  varname = "@#{meth.to_s}"
@@ -522,7 +530,8 @@ class Caesars
522
530
  return inst if b.nil?
523
531
 
524
532
  # Add to existing instance, if it exists. Otherwise create one anew.
525
- inst = instance_variable_set(varname, inst || #{modname.to_s}.new(name))
533
+ # NOTE: Module.nesting[1] == modname (e.g. Some::HighBall)
534
+ inst = instance_variable_set(varname, inst || Module.nesting[1].new(name))
526
535
  inst.instance_eval(&b)
527
536
  inst
528
537
  end
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.6
4
+ version: 0.6.7
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-18 00:00:00 -04:00
12
+ date: 2009-05-23 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -62,7 +62,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
62
62
  requirements: []
63
63
 
64
64
  rubyforge_project: caesars
65
- rubygems_version: 1.3.2
65
+ rubygems_version: 1.3.3
66
66
  signing_key:
67
67
  specification_version: 1
68
68
  summary: "Caesars: Rapid DSL prototyping in Ruby."