8000 GitHub - ufukcanli/ruby: Ruby code samples.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

ufukcanli/ruby

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ruby

Welcome to the Ruby repository! 🎉

This repository is a curated collection of Ruby code samples with accompanying notes and comments.

Getting Started

To explore the examples in this repository, ensure you have Ruby installed on your system.

Clone this repository to your local machine:

git clone https://github.com/your-username/ruby.git
cd ruby

Run any Ruby file using the ruby command:

ruby path/to/file.rb

Contents

This repository includes the following:

  • blocks/: Examples demonstrating Ruby blocks, including iterators and yielding.
    • basics.rb: Introduction to blocks and their usage.
    • each.rb: Examples of the each method and iterators.
    • enumerable.rb: Usage of the Enumerable module for collections.
    • yielding.rb: Advanced examples of yielding to blocks.
    • timing.rb: Measuring execution time using blocks.
    • sensor.rb: Simulating sensor checks with blocks.
    • debugging.rb: Using blocks for debugging output.
    • benchmark.rb: Measuring code execution time with the Benchmark module.
    • expectation.rb: Simple expectation-based test helper using blocks.
    • tag.rb: Generating HTML tags using blocks.
    • phone.rb: Example demonstrating a simple phone class and usage.
    • initializer.rb: Demonstrates object initialization with blocks and attribute assignment.
    • resources.rb: Managing resources (files, network, etc.) safely with blocks.
    • database_driver.rb: Managing database connections safely with blocks, similar to resources.rb but for databases.
    • database_driver_extra.rb: Extends the database driver example to include transaction management using blocks, following the same resource safety concepts.

License

This project is licensed under the MIT License.

About

Ruby code samples.

Topics

Resources

License

Stars

Watchers

Forks

Languages

0