Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 8955

Show
Ignore:
Timestamp:
02/29/08 14:30:20 (2 years ago)
Author:
tobie
Message:

pdoc: Add support for events.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • spinoffs/pdoc/trunk/CHANGELOG

    r8954 r8955  
     1* Add support for events (syntax subject to change) [Tobie] 
     2 
    13* More consistency [Tobie] 
    24 
  • spinoffs/pdoc/trunk/lib/p_doc/parser/description_nodes.rb

    r8944 r8955  
    77     
    88    def join(sep = "\n") 
    9       to_a.join(sep) 
     9      to_a.join(sep).strip 
    1010    end 
    1111     
     
    1515     
    1616    def inspect 
    17       text = truncate(15).gsub(/\n/, " ").inspect 
     17      text = truncate(15).gsub(/\n/, " ").strip.inspect 
    1818      "#<#{self.class} #{text}>" 
    1919    end 
  • spinoffs/pdoc/trunk/lib/p_doc/parser/documentation_nodes.rb

    r8954 r8955  
    228228      arguments_descriptions.elements 
    229229    end 
     230     
     231    def fires 
     232      event.respond_to?("name") ? event.name.text_value : nil 
     233    end 
    230234  end 
    231235   
  • spinoffs/pdoc/trunk/lib/p_doc/parser/treetop_files/documentation.treetop

    r8954 r8955  
    1919   
    2020  rule constructor_doc 
    21     start ebnf:(line constructor)+ arguments_descriptions text comment_end <Constructor> 
     21    start ebnf:(line constructor)+ arguments_descriptions event text comment_end <Constructor> 
    2222  end 
    2323   
     
    3131 
    3232  rule klass_method_doc 
    33     start ebnf:(line klass_method)+ arguments_descriptions text comment_end <KlassMethod> 
     33    start ebnf:(line klass_method)+ arguments_descriptions event text comment_end <KlassMethod> 
    3434  end 
    3535   
    3636  rule instance_method_doc 
    37     start ebnf:(line instance_method)+ arguments_descriptions text comment_end <InstanceMethod> 
     37    start ebnf:(line instance_method)+ arguments_descriptions event text comment_end <InstanceMethod> 
    3838  end 
    3939   
     
    5151   
    5252  rule utility_doc 
    53     start ebnf:(line utility)+ arguments_descriptions text comment_end <Utility> 
     53    start ebnf:(line utility)+ arguments_descriptions event text comment_end <Utility> 
    5454  end 
    5555   
     
    6565    argument_description* 
    6666  end 
     67   
     68  rule event 
     69    (line 'fires ' name:([a-zA-Z]+ (':' [a-zA-Z]+)*))? 
     70  end 
    6771end 
  • spinoffs/pdoc/trunk/test/fixtures/ajax.js

    r8953 r8955  
    4545 * - styles (String, Object, Hash): can be either a regular CSS string or 
    4646 *     a hash or regular object, in which case, properties need to be camelized 
     47 * fires element:style:updated 
     48 * 
    4749 * Sets the style of element 
    4850 * and returns it 
     
    5759  /** alias of: Element#foo 
    5860   * Element#bar() -> Element 
     61   * fires click 
    5962   **/ 
    6063 
  • spinoffs/pdoc/trunk/test/unit/documentation_test.rb

    r8954 r8955  
    454454  end 
    455455   
     456  def test_event 
     457    assert_equal "element:style:updated",  fixtures.find_by_name("Element#setStyle").fires 
     458    assert_equal nil,                      fixtures.find_by_name("Element#foo").fires 
     459    assert_equal "click",                  fixtures.find_by_name("Element#bar").fires 
     460  end 
     461   
    456462  def test_aliases 
    457463    fixture = fixtures.find_by_name("Element#setStyle")