Changeset 2048 for libcaca/trunk


Ignore:
Timestamp:
Nov 25, 2007, 10:48:30 AM (13 years ago)
Author:
Pascal Terjan
Message:
  • Little improvements in ruby doc + Made the doc a little more easy to read + Added an example on a nice way to have q, Q and Esc to cause exit
Location:
libcaca/trunk/ruby
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/ruby/ruby-caca.dox

    r2042 r2048  
    1616
    1717\code
    18 irb(main):007:0> Caca::Display.instance_methods.sort -
    19 Caca::Display.ancestors[1].instance_methods
     18$ irb -rcaca
     19irb(main):001:0> class Object
     20irb(main):002:1>   def Object.my_instance_methods
     21irb(main):003:2>     instance_methods.sort - ancestors[1].instance_methods
     22irb(main):004:2>   end
     23irb(main):005:1>   def Object.my_methods
     24irb(main):006:2>     methods.sort - ancestors[1].methods
     25irb(main):007:2>   end
     26irb(main):008:1> end
     27
     28irb(main):009:0> Caca::Display.my_instance_methods
    2029=> ["get_event", "height", "mouse=", "mouse_x", "mouse_y", "refresh",
    2130"set_mouse", "set_time", "set_title", "time", "time=", "title=", "width"]
     
    2332
    2433\code
    25 irb(main):008:0> Caca::Event.constants
     34irb(main):010:0> Caca::Event.constants
    2635=> ["Key", "Quit", "TYPE", "Mouse", "Resize"]
    2736\endcode
    2837
    2938\code
    30 irb(main):009:0> Caca::Event::Key.instance_methods - Caca::Event::Key.ancestors[1].instance_methods
     39irb(main):011:0> Caca::Event.my_instance_methods
     40=> ["quit?"]
     41\endcode
     42
     43\code
     44irb(main):012:0> Caca::Event::Key.my_instance_methods
    3145=> ["ch", "utf32", "utf8"]
    3246\endcode
    3347
    3448\code
    35 irb(main):010:0> Caca::Event::Key.instance_methods - Caca::Event::Mouse.ancestors[1].instance_methods
    36 => ["ch", "utf32", "utf8"]
    37 \endcode
    38 
    39 \code
    40 irb(main):011:0> Caca::Event::Mouse.instance_methods - Caca::Event::Mouse.ancestors[1].instance_methods
     49irb(main):013:0> Caca::Event::Mouse.my_instance_methods
    4150=> ["button", "x", "y"]
    4251\endcode
    4352
    4453\code
    45 irb(main):018:0> Caca::Event::Resize.instance_methods - Caca::Event::Resize.ancestors[1].instance_methods
     54irb(main):014:0> Caca::Event::Resize.my_instance_methods
    4655=> ["w", "h"]
    4756\endcode
     
    5766d.title = "Test !"
    5867d.refresh
     68
     69# Redefine Event::Key#quit? so that q, Q, and Esc become exit keys
     70module Caca
     71        class Event::Key
     72                def quit?
     73                        "qQ^[".split('').member?(@ch.chr)
     74                end
     75        end
     76end
     77
    5978while((e = d.get_event(Caca::Event, -1)) && ! e.quit?)
    6079    p e
  • libcaca/trunk/ruby/ruby-cucul.dox

    r2033 r2048  
    1313\code
    1414$ irb -rcucul
    15 irb(main):001:0> Cucul.constants
     15irb(main):001:0> class Object
     16irb(main):002:1>   def Object.my_instance_methods
     17irb(main):003:2>     instance_methods.sort - ancestors[1].instance_methods
     18irb(main):004:2>   end
     19irb(main):005:1>   def Object.my_methods
     20irb(main):006:2>     methods.sort - ancestors[1].methods
     21irb(main):007:2>   end
     22irb(main):008:1> end
     23
     24irb(main):009:0> Cucul.constants
    1625=> ["BROWN", "BOLD", "GREEN", "LIGHTMAGENTA", "LIGHTBLUE", "BLINK",
    1726"MAGENTA", "DEFAULT", "TRANSPARENT", "BLUE", "LIGHTRED", "DARKGRAY",
     
    2130
    2231\code
    23 irb(main):002:0> Cucul::Canvas.methods.sort -
    24 Cucul::Canvas.ancestors[1].methods
     32irb(main):010:0> Cucul::Canvas.my_methods
    2533=> ["export_list", "import_list"]
    2634\endcode
    2735
    2836\code
    29 irb(main):003:0> Cucul::Canvas.instance_methods.sort -
    30 Cucul::Canvas.ancestors[1].instance_methods
     37irb(main):003:0> Cucul::Canvas.my_instance_methods
    3138=> ["attr=", "blit", "clear", "create_frame", "cursor_x", "cursor_y",
    3239"dither_bitmap", "draw_box", "draw_circle", "draw_cp437_box", "draw_ellipse",
     
    4552
    4653\code
    47 irb(main):004:0> Cucul::Font.methods.sort -
    48 Cucul::Font.ancestors[1].methods
     54irb(main):004:0> Cucul::Font.my_methods
    4955=> ["list"]
    5056\endcode
    5157
    5258\code
    53 irb(main):005:0> Cucul::Font.instance_methods.sort -
    54 Cucul::Font.ancestors[1].instance_methods
     59irb(main):005:0> Cucul::Font.my_instance_methods
    5560=> ["blocks", "height", "width"]
    5661\endcode
    5762
    5863\code
    59 irb(main):006:0> Cucul::Dither.instance_methods.sort -
    60 Cucul::Dither.ancestors[1].instance_methods
     64irb(main):006:0> Cucul::Dither.my_instance_methods
    6165=> ["algorithm=", "algorithm_list", "antialias=", "antialias_list",
    6266"brightness=", "charset=", "charset_list", "color=", "color_list",
Note: See TracChangeset for help on using the changeset viewer.