Menu
CoddyTech
Course

Ruby for TypeScript Developers

Move from TypeScript to Ruby through 48 multi-file tasks covering flow, blocks, collections, errors, classes, modules and inheritance. Build a lending desk and port two complete source programs.

TypeScript and Ruby side by side

The same program in TypeScript and in Ruby, from the lessons of this course.

  1. Output and Comments

    TypeScript adds static checking while the chosen runtime provides output APIs. In Node, console.log adds a newline and process.stdout.write allows exact text, like Ruby puts and print respectively. TypeScript uses slash comments while Ruby uses a hash sign…

    TypeScript
    1export {};2process.stdout.write("oak!");3// A comment4console.log("#seed");
    Ruby
    1print "oak!"2# A real comment3puts "#seed"
  2. Conditional Values

    TypeScript uses a conditional expression to select a value, while Ruby if itself yields its chosen branch result. TypeScript applies static type rules and narrowing; Ruby determines behavior dynamically when the result is used. Only the selected branch…

    TypeScript
    1export {};2const wet:boolean=false;const label=wet?"rain":"sun";console.log(label);
    Ruby
    1wet = false2icon = if wet3  "umbrella"4else5  "sun"6end7puts icon
  3. Arrays and Indexing

    TypeScript arrays use zero-based indexes; a missing runtime read yields undefined and at supports negative offsets. Static indexing safety depends on compiler options, while Ruby ordinary missing reads yield nil and negative bracket indexes count from the…

    TypeScript
    1export {};2const values:number[]=[4,8];console.log(values.at(-1));console.log(values[9]===undefined?"missing":values[9]);
    Ruby
    1values = [4, 8]2puts values[-1]3puts(values[9].nil? ? "missing" : values[9])
  4. Mutation and Aliases

    TypeScript array assignment shares an object reference, as Ruby array assignment does. TypeScript reverse mutates, while Ruby reverse! mutates and reverse returns another array. Const prevents rebinding and readonly limits checked operations rather than…

    TypeScript
    1export {};2const values:number[]=[1,2,3];const alias=values;values.reverse();console.log(alias.join(" "));
    Ruby
    1values = [1, 2, 3]2alias_values = values3values.reverse!4puts alias_values.join(" ")
  5. Modules as Namespaces

    TypeScript modules use imports and exports under the chosen runtime/module system; type-only declarations disappear after compilation. Ruby require_relative loads a file and modules explicitly organize constants and methods. A filename creates no Ruby…

    TypeScript
    1export {};2class TextTools{static shout(text:string):string{return text.toUpperCase();}}3console.log(TextTools.shout("elm"));
    Ruby
    1module TextTools2  def self.shout(text)3    text.upcase4  end5end6puts TextTools.shout("elm")
  6. Composing Objects

    TypeScript and Ruby classes can retain collaborator references without cloning them or transferring exclusive ownership. TypeScript interfaces specify structural compile-time contracts, while Ruby duck typing calls compatible methods at runtime. Delegation…

    TypeScript
    1export {};2interface Lens{label():string}3class WideLens implements Lens{label():string{return "wide";}}4class Camera{constructor(private lens:Lens){}label():string{return this.lens.label();}}5console.log(new Camera(new WideLens()).label());
    Ruby
    1class Lens2  def label; "wide"; end3end4class Camera5  def initialize(lens); @lens = lens; end6  def label; @lens.label; end7end8puts Camera.new(Lens.new).label

Syllabus

9 chapters48 lessons1 project48 challenges99 quiz questions

More courses for TypeScript developers

Learn Ruby from another language

Frequently asked questions

Who is Ruby for TypeScript Developers for?

For people who already write TypeScript and want to learn Ruby. Each lesson starts from TypeScript you know and shows how Ruby does the same thing, so you skip the beginner basics.

Do I need to know Ruby already?

No. The course starts with your first Ruby program. You need TypeScript basics: variables, conditions, loops, functions and collections.

How many lessons does Ruby for TypeScript Developers have?

Ruby for TypeScript Developers contains 48 interactive lessons you can complete at your own pace.

What does Ruby for TypeScript Developers cover?

The course is organized into chapters covering: Start with Ruby, Flow and Methods, Collections and Blocks, Mutation and Errors, and more.

Is Ruby for TypeScript Developers free?

Yes. Every course on Coddy is free to start. You can complete lessons in your browser without any downloads or signup.

Coddy programming languages illustration

Start Ruby for TypeScript Developers for free

Get started