Learning Ruby - 10 Exploiting Classes. Ruby's Class Library Array - an ordered collection of objects Bignum - really big integer values Binding - remembering.

Slides:



Advertisements
Similar presentations
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 14 Introduction to Ruby.
Advertisements

More about Ruby Maciej Mensfeld Presented by: Maciej Mensfeld More about Ruby dev.mensfeld.pl github.com/mensfeld.
Chapter 2.2 – More about Ruby Maciej Mensfeld Presented by: Maciej Mensfeld More about Ruby dev.mensfeld.pl github.com/mensfeld senior.
John Pinney Ruby in 20 minutes John Pinney
Oracle PL/SQL IV Exceptions Packages.
Types in Ruby and other languages….  Classes and objects (vs prototypes)  Instance variables/encapsulation  Object creation  Object equality/comparison.
Chapter 3 DATA: TYPES, CLASSES, AND OBJECTS. Chapter 3 Data Abstraction Abstract data types allow you to work with data without concern for how the data.
ECS 15 if and random. Topic  Testing user input using if statements  Truth and falsehood in Python  Getting random numbers.
This Time Pointers (declaration and operations) Passing Pointers to Functions Const Pointers Bubble Sort Using Pass-by-Reference Pointer Arithmetic Arrays.
CS-341 Dick Steflik Introduction. C++ General purpose programming language A superset of C (except for minor details) provides new flexible ways for defining.
CS 225 Java Review. Java Applications A java application consists of one or more classes –Each class is in a separate file –Use the main class to start.
Guide To UNIX Using Linux Third Edition
Scripting with Ruby What is a scripting language? What is Ruby?
Introduction to Ruby CSE 413 Autumn 2008 Credit: Dan Grossman, CSE341.
Differences between C# and C++ Dr. Catherine Stringfellow Dr. Stewart Carpenter.
Storing data Getting data out Data types Ruby as a foundation Program Variables Click icon to hear comments (the download may take a minute)
Chapter 3.1:Operating Systems Concepts 1. A Computer Model An operating system has to deal with the fact that a computer is made up of a CPU, random access.
Introduction to Java Appendix A. Appendix A: Introduction to Java2 Chapter Objectives To understand the essentials of object-oriented programming in Java.
CMSC 330: Organization of Programming Languages Ruby Hash Tables (and other topics)
1 Inheritance and Polymorphism Chapter 9. 2 Polymorphism, Dynamic Binding and Generic Programming public class Test { public static void main(String[]
Ruby! Useful as a scripting language – script: A small program meant for one time use – Targeted towards small to medium size projects Use by: – Amazon,
Adapted from Prof. Necula UCB CS 1641 Overview of COOL ICOM 4029 Lecture 2 ICOM 4029 Fall 2008.
1 Python CIS*2450 Advanced Programming Concepts Material for this lecture was developed by Dr. D. Calvert.
1 Dr Alexiei Dingli Web Science Stream Advanced ROR.
Sigma Lisp Σλ Sam Davis Nick Alexander. What is Sigma Lisp? ● New dialect of Lisp ● Designed to be as expressive as possible.
17. ADVANCED USES OF POINTERS. Dynamic Storage Allocation Many programs require dynamic storage allocation: the ability to allocate storage as needed.
Algorithm Programming Bar-Ilan University תשס"ח by Moshe Fresko.
Introduction to Java University of Sunderland CSE301 Harry R. Erwin, PhD.
IT253: Computer Organization Lecture 3: Memory and Bit Operations Tonga Institute of Higher Education.
Introduction to Scheme Lectures on The Scheme Programming Language, 2 nd Ed. R. Kent Dybvig.
DHTML AND JAVASCRIPT Genetic Computer School LESSON 5 INTRODUCTION JAVASCRIPT G H E F.
Chapter 2: Linux & POSIX “She sells bash shells by the C shore”
Netprog: Java Intro1 Crash Course in Java. Netprog: Java Intro2 Why Java? Network Programming in Java is very different than in C/C++ –much more language.
I Power Int 2 Computing Software Development High Level Language Constructs.
Week 14 - Monday.  What did we talk about last time?  Introduction to C++  Input and output  Functions  Overloadable  Default parameters  Pass.
And other languages….  Array literals/initialization a = [1,2,3] a2 = [-10..0, 0..10] a3 = [[1,2],[3,4]] a4 = [w*h, w, h] a5 = [] empty = Array.new zeros.
Copyright © Curt Hill Structured Data What this course is about.
C463 / B551 Artificial Intelligence Dana Vrajitoru Python.
Introduction to Java COM379 (Part-Time) University of Sunderland Harry R Erwin, PhD.
C# Classes and Inheritance CNS 3260 C#.NET Software Development.
Chapter 21: The Standard Library Copyright © 2008 W. W. Norton & Company. All rights reserved. 1 Chapter 21 The Standard Library.
Fall 2002CS 150: Intro. to Computing1 Streams and File I/O (That is, Input/Output) OR How you read data from files and write data to files.
Introduction to Java Chapter 7 - Classes & Object-oriented Programming1 Chapter 7 Classes and Object-Oriented Programming.
Functions: Part 2 of /11/10: Lecture 16 CMSC 104, Section 0101 John Y. Park 1.
School of Computer Science & Information Technology G6DICP - Lecture 4 Variables, data types & decision making.
XML Query: xQuery Reference: Xquery By Priscilla Walmsley, Published by O’Reilly.
Scripting with Ruby What is a scripting language? What is Ruby?
File Systems cs550 Operating Systems David Monismith.
Object Oriented Software Development 4. C# data types, objects and references.
Page 1 Data Structures in C for Non-Computer Science Majors Kirs and Pflughoeft Strings Chapter 5.
CIS 200 Test 01 Review. Built-In Types Properties  Exposed “Variables” or accessible values of an object  Can have access controlled via scope modifiers.
Silberschatz, Galvin and Gagne ©2011 Operating System Concepts Essentials – 8 th Edition Chapter 2: The Linux System Part 2.
Swift. Introduced in 2014 Replaces Objective-C as “recommended development language” “safer, succinct, readable” Emphasizes type safety.
Lecture 5 – Function (Part 2) FTMK, UTeM – Sem /2014.
Module 5: I/O and Strings #1 2000/01Scientific Computing in OOCourse code 3C59 Module 5: I/O and STRINGS In this module we will cover The C++ input and.
Chapter 9: Data types and data structures OCR Computing for A Level © Hodder Education 2009.
.... RuDy Perform like a Star Tomasz Stachewicz Euruko 2009 :: Barcelona.
6 - Ruby in the Rough 7 - Ruby on Rails 03/03/2006 Taylan Yemliha
Type Checking, and Scopes
CIS 200 Test 01 Review.
Ruby Classes, Modules & Mixins
Variables, Expressions, and IO
Chapter 2: The Linux System Part 2
Pointers C#, pointers can only be declared to hold the memory addresses of value types int i = 5; int *p; p = &i; *p = 10; // changes the value of i to.
B065: PROGRAMMING Variables 1.
Let’s start from the beginning
CSE 153 Design of Operating Systems Winter 19
Data Types and Maths Programming Guides.
ICOM 4029 Fall 2003 Lecture 2 (Adapted from Prof. Necula UCB CS 164)
Functions, Part 2 of 3 Topics Functions That Return a Value
Presentation transcript:

Learning Ruby - 10 Exploiting Classes

Ruby's Class Library Array - an ordered collection of objects Bignum - really big integer values Binding - remembering the context of some executable code Class - the grand-daddy of all new classes Comparable - a mixin that allows objects to be compared Continuation - allows for non-local returns from blocks

More Ruby Classes Dir - working with directories and the underlying filesystem Enumerable - a mixin that allows for traversal, searching and sorting Errno - gives access to the OS's error codes Exception - lets your class raise and rescue exceptions FalseClass - is used to represent false (what else could it be used for?!?) File - allows for classes to access files within the filesystem

Even More Ruby Classes File::Stat - access stuff about files FileTest - test certain things about files Fixnum - a native machine word interger Float - represents real numbers GC - for fiddling with garbage collection Hash - an collection of name/value pairs

Yet More Ruby Classes Integer - whole numbers IO - input/output class Kernel - included in every class, lets you get at stuff Marshal - converts Ruby object to/from byte- streams MatchData - used with regexes Math - we all hate this one, don't we? Method - mucking about with object methods

More? Here They Are... Module - a collection of methods and constants NilClass - the class that implements nil Numeric - base class of Integer, Fixnum and Bignum Object - the grand-mammy of all classes in Ruby ObjectSpace - more interaction with the garbage collector Proc - binding blocks of code to local variables

It Keeps On Coming... Process - the manipulation of processes Process::GID - interacting with the underlying OS Process::Status - information on running/terminated processes Process::Sys - system call-level access to the OS environment Process::UID - not unlike Process::GID

The End Is In Sight... Range - supporting ranges Regexp - OO-style regex technology Signal - working with signals from the OS String - working with strings Struct - bundling attributes together in a convenient way Struct::Tms - information on process times Symbol - :support :for :those :cool :little :symbols

I Lied - There's Still More Thread - a thread of program execution ThreadGroup - tracking a number of threads Time - working with dates and times TrueClass - is used to represent true (see FalseClass) UnboundMethod - not associating methods with objects (weird)

More... Ruby So Far Don't reinvent base classes - use the built-in's instead Inherit class behaviours using the < notation Refer to Chapter 27 of The PickAxe for an extensive discussion