1 / 7

Ruby Odds & Ends

CS 480/680 – Comparative Languages. Ruby Odds & Ends. I/O Shortcuts. ARGV ARGF – the input stream specified on the command line Handy for file-processing scripts. Proc Objects. class JukeboxButton < Button def initialize(label, &action) super(label) @action = action end

teness
Download Presentation

Ruby Odds & Ends

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CS 480/680 – Comparative Languages Ruby Odds & Ends

  2. I/O Shortcuts • ARGV • ARGF – the input stream specified on the command line • Handy for file-processing scripts Odds & Ends

  3. Proc Objects class JukeboxButton < Button def initialize(label, &action) super(label) @action = action end def buttonPressed @action.call(self) end end bStart = JukeboxButton.new("Start") { songList.start } bPause = JukeboxButton.new("Pause") { songList.pause } Odds & Ends

  4. The Debugger • ruby –r debug script.rb • List (l) • Display (disp) • Break (b & del) • Watchpoints (w) • Continue (c) • Backtrace (where) • Help !!! Odds & Ends

  5. The Profiler • See profiler.rb Odds & Ends

  6. The Standard Library • Included with ruby, but you need to use ‘require’ for each library module you want to use. • Class Date • Module Find – see clean • Class File • Module Parsedate • Class Tempfile • Library Timeout Odds & Ends

  7. Require “English” $* $ARGV $" $LOADED_FEATURES $? $CHILD_STATUS $& $MATCH $< $DEFAULT_INPUT $. $NR $> $DEFAULT_OUTPUT $, $OFS $! $ERROR_INFO $\ $ORS $@ $ERROR_POSITION $\ $OUTPUT_RECORD_SEPARATOR $; $FIELD_SEPARATOR $, $OUTPUT_FIELD_SEPARATOR $; $FS $$ $PID $= $IGNORECASE $' $POSTMATCH $. $INPUT_LINE_NUMBER $` $PREMATCH $/ $INPUT_RECORD_SEPARATOR $$ $PROCESS_ID $~ $LAST_MATCH_INFO $0 $PROGRAM_NAME $+ $LAST_PAREN_MATCH $/ $RS $_ $LAST_READ_LINE Odds & Ends

More Related