background preloader

Ruby

Facebook Twitter

Veille technologique sur le langage Ruby

Module: Benchmark (Ruby 2.6.3) Benchmark(caption = "", label_width = nil, format = nil, *labels) click to toggle source Invokes the block with a Benchmark::Report object, which may be used to collect and report on the results of individual benchmark tests.

Module: Benchmark (Ruby 2.6.3)

Reserves label_width leading spaces for labels on each line. Prints caption at the top of the report, and uses format to format each line. Returns an array of Benchmark::Tms objects. If the block returns an array of Benchmark::Tms objects, these will be used to format additional lines of output. Note: Other methods provide a simpler interface to this one, and are suitable for nearly all benchmarking requirements. Example: Generates: Understanding how Ruby stores objects in memory - the Ruby Heap - The Irish Penguin. Ruby has it's own heap management which actually consists of several 'Ruby Heaps' to manage objects created during the execution of a Ruby program; this is separate from the System Heap for your Operating System.

Understanding how Ruby stores objects in memory - the Ruby Heap - The Irish Penguin

Each individual Ruby Heap contains Slots, with each Slot able to one reference one object. The entire space that an object takes up in memory is not stored inside the Slot. Rather each Slot is a small fixed size space which can be thought of as the Ruby interpreter's handle a location in memory. This location exists outside of the Ruby Heap itself and contains the real 'meat' of the object.

Glfw - A Ruby C-extension gem for the GLFW library (open GL, game framework oriented) Kramdown. Class: Logger (Ruby 2.6.2) Description¶ ↑ The Logger class provides a simple but sophisticated logging utility that you can use to output messages. The messages have associated levels, such as INFO or ERROR that indicate their importance. You can then give the Logger a level, and only messages at that level or higher will be printed. The levels are: An unknown message that should always be logged.

An unhandleable error that results in a program crash. Write cross-platform native apps in Ruby. Really useful libraries. So these have been on my github for a while now, but I've never made a post about them yet.

Really useful libraries

I use these in each project I make, and they _really_ help me out. Library name + short description: Non-gosu libraries: lib_misc.rb - Just my personal library of semi-useful methods, might be useful to someone. lib.rb - Intended to be a "library loader library", but I lost interest in making it do that, it's now just a very small collection of methods. lib_encrypt.rb - Very useful collection of encryption / compression methods, and their counterparts. Gosu libraries (The really useful ones): Rmagick/rmagick. Advanced Ruby Programming: 10 Steps to Mastery. Metrics Documentation & Statistics - The Ruby Toolbox. Today I'm happy to introduce a new metrics documentation & statistics section.

Metrics Documentation & Statistics - The Ruby Toolbox

As part of the ongoing effort of making the site more beginner-friendly all project metrics now link to a dedicated page that explains the purpose of the metric and gives guidance on how it can help choose a library. To make those pages more appealing to all visitors the pages also feature statistics around the Ruby ecosystem, including charts that display the distribution of this metric's values as well as top project rankings. Which year saw the most new Rubygems? Which gems have the most reverse dependencies? How many gems saw their last release in which year?

This addition continues the recently started effort of bringing more documentation and guidance to the site by making documentation a dedicated site section and bringing a sidebar navigation, enabling the easy addition and discovery of upcoming content. Best,Christoph. Ruby, Sudoku challenge and How to tackle problems – Gavin Yap. Sudoku Challenge Believed it or not but this challenge is being asked by Apple and Uber.

Ruby, Sudoku challenge and How to tackle problems – Gavin Yap

Well, I do know many of the hi-tech companies employs brilliant engineers/coders, probably the bests in the market. But really, to solve Sudoku??? I have been developing and programming for quite some time, 15 years or so, although I’m not a developer by profession, I did programming to solve some work issues and as a hobby, but solving Sudoku is not something I could relate over these years.

Requirements The requirements of the challenge is to check if that a given Sudoku grid puzzle is valid or not. The first few problems I encounter before even attempting to solve this problem are: I have no knowledge of sudoku rulesI am not a reader. So all these problems are fallen dominoes over the main problem. Ruby. Build an API with the Jets Ruby Serverless Framework - BoltOps Blog.

In this blog post, I’ll cover how to build a simple API service on AWS Lambda with the Jets Ruby Serverless Framework.

Build an API with the Jets Ruby Serverless Framework - BoltOps Blog

Jets New API Mode The jets new command has a few different modes: html, api, and job. We’ll use the handy api mode for this tutorial to create a starter project designed for APIs. jets new demo --mode api cd demo We’ve successfully generated a starter Jets project. We are ready to now add some API code. Scaffold.