<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -65,6 +65,12 @@ module Gantty
     return task
   end
   
+  def self.create_resource(name, &amp;block)
+    resource = Resource.new(name)
+    resource.instance_eval(&amp;block)
+    return resource
+  end
+  
   class GanttChart
     
     attr_accessor :resources, :tasks
@@ -85,6 +91,12 @@ module Gantty
       @tasks &lt;&lt; task      
     end
     
+    def resource(name, &amp;block)
+      resource = Resource.new(name)
+      resource.instance_eval(&amp;block)
+      @resources &lt;&lt; resource
+    end
+    
     def parse_gantt
       depends = { 1 =&gt; [], 2 =&gt; [], 3 =&gt; [], 4 =&gt; [] }
       @gantt.xpath('//resource').each { |r| @resources &lt;&lt; Resource.new(r) }
@@ -472,6 +484,16 @@ module Gantty
         @id = r.attributes[&quot;id&quot;].to_i
       end
     end
+
+    %w/ name email phone /.each do |attribute|
+      define_method(attribute.to_sym) do |*args|
+        set = *args
+        set ||= nil 
+        return self.instance_variable_get(&quot;@&quot; + attribute) unless set
+        self.send(&quot;#{attribute}=&quot;.to_sym, set)
+      end
+    end      
+
     
     def to_xml
       x = Builder::XmlMarkup.new :indent =&gt; 2</diff>
      <filename>lib/gantty.rb</filename>
    </modified>
    <modified>
      <diff>@@ -20,5 +20,31 @@ describe &quot;Resource&quot; do
   
   it &quot;should return itself in correct XML&quot;
   it &quot;should require a name&quot;
+  
+  it &quot;can be created with new syntax&quot; do
+    me = Gantty::create_resource &quot;Adam Alpha&quot; do
+      email &quot;adam.alpha@gmail.com&quot;
+      phone &quot;555-555-1234&quot;
+    end
+    
+    me.name.should == &quot;Adam Alpha&quot;
+    me.email.should == &quot;adam.alpha@gmail.com&quot;
+    me.phone.should == &quot;555-555-1234&quot;
+  end
+  
+  it &quot;can be created within a Gantty block&quot; do
+    g = Gantty::create do
+      resource &quot;Adam Alpha&quot; do
+        email &quot;adam.alpha@gmail.com&quot;
+        phone &quot;555-555-2345&quot;
+      end
+    end
+    
+    me = g.resources.first
+    me.name.should == &quot;Adam Alpha&quot;
+    me.email.should == &quot;adam.alpha@gmail.com&quot;
+    me.phone.should == &quot;555-555-2345&quot;
+
+  end
 
 end</diff>
      <filename>spec/resource_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>e3b839acf5202d8a122a91729efd7573450c24f1</id>
    </parent>
  </parents>
  <author>
    <name>Ardekantur</name>
    <email>greystone@ardekantur.com</email>
  </author>
  <url>http://github.com/ardekantur/gantty/commit/262da8034f3686adac77d04e22e7b480fcbdd893</url>
  <id>262da8034f3686adac77d04e22e7b480fcbdd893</id>
  <committed-date>2008-11-30T20:07:52-08:00</committed-date>
  <authored-date>2008-11-30T20:07:52-08:00</authored-date>
  <message>resources use new syntax outside and inside of Gantty::create blocks</message>
  <tree>4f3fe2f50c3c764933a58b28dac880556b80a2a4</tree>
  <committer>
    <name>Ardekantur</name>
    <email>greystone@ardekantur.com</email>
  </committer>
</commit>
