From 73f50e3ee94cd892c1d0ac76599e73f4366fae6d Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sat, 11 Oct 2025 15:26:29 +0300 Subject: Update content for gemtext --- about/resources.gmi | 200 +++++------ gemfeed/2021-07-04-the-well-grounded-rubyist.gmi | 5 + .../2021-07-04-the-well-grounded-rubyist.gmi.tpl | 4 + .../2025-10-11-the-well-grounded-rubyist-notes.gmi | 204 +++++++++++ ...5-10-11-the-well-grounded-rubyist-notes.gmi.tpl | 204 +++++++++++ gemfeed/atom.xml | 387 +++++++++++++-------- gemfeed/index.gmi | 1 + index.gmi | 3 +- uptime-stats.gmi | 2 +- 9 files changed, 766 insertions(+), 244 deletions(-) create mode 100644 gemfeed/2025-10-11-the-well-grounded-rubyist-notes.gmi create mode 100644 gemfeed/2025-10-11-the-well-grounded-rubyist-notes.gmi.tpl diff --git a/about/resources.gmi b/about/resources.gmi index 6968d45b..afe6ba0a 100644 --- a/about/resources.gmi +++ b/about/resources.gmi @@ -36,106 +36,106 @@ You won't find any links on this site because, over time, the links will break. In random order: * Amazon Web Services in Action; Michael Wittig and Andreas Wittig; Manning Publications -* Higher Order Perl; Mark Dominus; Morgan Kaufmann +* Raku Fundamentals; Moritz Lenz; Apress * Think Raku (aka Think Perl 6); Laurent Rosenfeld, Allen B. Downey; O'Reilly -* Effective awk programming; Arnold Robbins; O'Reilly -* Programming Ruby 3.3 (5th Edition); Noel Rappin, with Dave Thomas; The Pragmatic Bookshelf -* Learn You a Haskell for Great Good!; Miran Lipovaca; No Starch Press -* Raku Recipes; J.J. Merelo; Apress -* Tmux 2: Productive Mouse-free Development; Brain P. Hogan; The Pragmatic Programmers -* Ultimate Go Notebook; Bill Kennedy -* Distributed Systems: Principles and Paradigms; Andrew S. Tanenbaum; Pearson -* Developing Games in Java; David Brackeen and others...; New Riders -* Systemprogrammierung in Go; Frank Müller; dpunkt -* C++ Programming Language; Bjarne Stroustrup; -* The Practise of System and Network Administration; Thomas A. Limoncelli, Christina J. Hogan, Strata R. Chalup; Addison-Wesley Professional Pro Git; Scott Chacon, Ben Straub; Apress -* DevOps And Site Reliability Engineering Handbook; Stephen Fleming; Audible -* 97 things every SRE should know; Emil Stolarsky, Jaime Woo; O'Reilly -* Hands-on Infrastructure Monitoring with Prometheus; Joel Bastos, Pedro Araujo; Packt -* The Docker Book; James Turnbull; Kindle * Programming Perl aka "The Camel Book"; Tom Christiansen, brian d foy, Larry Wall & Jon Orwant; O'Reilly -* The Go Programming Language; Alan A. A. Donovan; Addison-Wesley Professional +* The Kubernetes Book; Nigel Poulton; Unabridged Audiobook +* Object-Oriented Programming with ANSI-C; Axel-Tobias Schreiner * Site Reliability Engineering; How Google runs production systems; O'Reilly -* Chaos Engineering - System Resiliency in Practice; Casey Rosenthal and Nora Jones; eBook -* Concurrency in Go; Katherine Cox-Buday; O'Reilly -* Data Science at the Command Line; Jeroen Janssens; O'Reilly -* Modern Perl; Chromatic ; Onyx Neon Press +* The Practise of System and Network Administration; Thomas A. Limoncelli, Christina J. Hogan, Strata R. Chalup; Addison-Wesley Professional Pro Git; Scott Chacon, Ben Straub; Apress * Effective Java; Joshua Bloch; Addison-Wesley Professional -* Object-Oriented Programming with ANSI-C; Axel-Tobias Schreiner -* Polished Ruby Programming; Jeremy Evans; Packt Publishing -* DNS and BIND; Cricket Liu; O'Reilly -* The Kubernetes Book; Nigel Poulton; Unabridged Audiobook -* Go Brain Teasers - Exercise Your Mind; Miki Tebeka; The Pragmatic Programmers -* Systems Performance Tuning; Gian-Paolo D. Musumeci and others...; O'Reilly -* The DevOps Handbook; Gene Kim, Jez Humble, Patrick Debois, John Willis; Audible -* 21st Century C: C Tips from the New School; Ben Klemens; O'Reilly -* Learn You Some Erlang for Great Good; Fred Herbert; No Starch Press +* Data Science at the Command Line; Jeroen Janssens; O'Reilly * Java ist auch eine Insel; Christian Ullenboom; -* Funktionale Programmierung; Peter Pepper; Springer -* Clusterbau mit Linux-HA; Michael Schwartzkopff; O'Reilly -* The KCNA (Kubernetes and Cloud Native Associate) Book; Nigel Poulton +* Perl New Features; Joshua McAdams, brian d foy; Perl School +* Ultimate Go Notebook; Bill Kennedy +* Systemprogrammierung in Go; Frank Müller; dpunkt +* The DevOps Handbook; Gene Kim, Jez Humble, Patrick Debois, John Willis; Audible * The Pragmatic Programmer; David Thomas; Addison-Wesley * Kubernetes Cookbook; Sameer Naik, Sébastien Goasguen, Jonathan Michaux; O'Reilly +* Hands-on Infrastructure Monitoring with Prometheus; Joel Bastos, Pedro Araujo; Packt +* Raku Recipes; J.J. Merelo; Apress +* Distributed Systems: Principles and Paradigms; Andrew S. Tanenbaum; Pearson +* 21st Century C: C Tips from the New School; Ben Klemens; O'Reilly +* Learn You Some Erlang for Great Good; Fred Herbert; No Starch Press * Leanring eBPF; Liz Rice; O'Reilly -* Perl New Features; Joshua McAdams, brian d foy; Perl School -* Raku Fundamentals; Moritz Lenz; Apress -* Terraform Cookbook; Mikael Krief; Packt Publishing * Pro Puppet; James Turnbull, Jeffrey McCune; Apress +* Learn You a Haskell for Great Good!; Miran Lipovaca; No Starch Press +* DNS and BIND; Cricket Liu; O'Reilly +* Go Brain Teasers - Exercise Your Mind; Miki Tebeka; The Pragmatic Programmers +* C++ Programming Language; Bjarne Stroustrup; +* 97 things every SRE should know; Emil Stolarsky, Jaime Woo; O'Reilly +* Systems Performance Tuning; Gian-Paolo D. Musumeci and others...; O'Reilly +* Effective awk programming; Arnold Robbins; O'Reilly +* Chaos Engineering - System Resiliency in Practice; Casey Rosenthal and Nora Jones; eBook +* The Docker Book; James Turnbull; Kindle +* Polished Ruby Programming; Jeremy Evans; Packt Publishing +* The KCNA (Kubernetes and Cloud Native Associate) Book; Nigel Poulton +* The Go Programming Language; Alan A. A. Donovan; Addison-Wesley Professional +* Terraform Cookbook; Mikael Krief; Packt Publishing +* Developing Games in Java; David Brackeen and others...; New Riders +* DevOps And Site Reliability Engineering Handbook; Stephen Fleming; Audible +* Programming Ruby 3.3 (5th Edition); Noel Rappin, with Dave Thomas; The Pragmatic Bookshelf +* Higher Order Perl; Mark Dominus; Morgan Kaufmann +* Clusterbau mit Linux-HA; Michael Schwartzkopff; O'Reilly * 100 Go Mistakes and How to Avoid Them; Teiva Harsanyi; Manning Publications +* Concurrency in Go; Katherine Cox-Buday; O'Reilly +* Tmux 2: Productive Mouse-free Development; Brain P. Hogan; The Pragmatic Programmers +* Funktionale Programmierung; Peter Pepper; Springer +* Modern Perl; Chromatic ; Onyx Neon Press ## Technical references I didn't read them from the beginning to the end, but I am using them to look up things. The books are in random order: -* Relayd and Httpd Mastery; Michael W Lucas -* Algorithms; Robert Sedgewick, Kevin Wayne; Addison Wesley * Understanding the Linux Kernel; Daniel P. Bovet, Marco Cesati; O'Reilly -* Go: Design Patterns for Real-World Projects; Mat Ryer; Packt +* Implementing Service Level Objectives; Alex Hidalgo; O'Reilly * Groovy Kurz & Gut; Joerg Staudemeier; O'Reilly +* Relayd and Httpd Mastery; Michael W Lucas +* Go: Design Patterns for Real-World Projects; Mat Ryer; Packt * BPF Performance Tools - Linux System and Application Observability, Brendan Gregg; Addison Wesley -* Implementing Service Level Objectives; Alex Hidalgo; O'Reilly +* Algorithms; Robert Sedgewick, Kevin Wayne; Addison Wesley * The Linux Programming Interface; Michael Kerrisk; No Starch Press ## Self-development and soft-skills books In random order: -* The Joy of Missing Out; Christina Crook; New Society Publishers -* The Off Switch; Mark Cropley; Virgin Books (RE-READ 1ST TIME) -* The Phoenix Project - A Novel About IT, DevOps, and Helping your Business Win; Gene Kim and Kevin Behr; Trade Select +* Digital Minimalism; Cal Newport; Portofolio Penguin * Psycho-Cybernetics; Maxwell Maltz; Perigee Books +* Who Moved My Cheese?; Dr. Spencer Johnson; Vermilion +* Coders at Work - Reflections on the craft of programming, Peter Seibel and Mitchell Dorian et al., Audiobook +* The Joy of Missing Out; Christina Crook; New Society Publishers +* Ultralearning; Scott Young; Thorsons +* Eat That Frog!; Brian Tracy; Hodder Paperbacks * The 7 Habits Of Highly Effective People; Stephen R. Covey; Simon & Schuster UK -* Ultralearning; Anna Laurent; Self-published via Amazon -* Solve for Happy; Mo Gawdat (RE-READ 1ST TIME) +* Deep Work; Cal Newport; Piatkus +* The Phoenix Project - A Novel About IT, DevOps, and Helping your Business Win; Gene Kim and Kevin Behr; Trade Select +* The Daily Stoic; Ryan Holiday, Stephen Hanselman; Profile Books +* Stop starting, start finishing; Arne Roock; Lean-Kanban University * Meditation for Mortals, Oliver Burkeman, Audiobook +* The Complete Software Developer's Career Guide; John Sonmez; Unabridged Audiobook +* The Obstacle Is The Way; Ryan Holiday; Profile Books Ltd +* So Good They Can't Ignore You; Cal Newport; Business Plus +* The Power of Now; Eckhard Tolle; Yellow Kite +* The Off Switch; Mark Cropley; Virgin Books (RE-READ 1ST TIME) +* Time Management for System Administrators; Thomas A. Limoncelli; O'Reilly +* 97 Things Every Engineering Manager Should Know; Camille Fournier; Audiobook +* Influence without Authority; A. Cohen, D. Bradford; Wiley +* The Bullet Journal Method; Ryder Carroll; Fourth Estate * Slow Productivity; Cal Newport; Penguin Random House -* Consciousness: A Very Short Introduction; Susan Blackmore; Oxford Uiversity Press +* Ultralearning; Anna Laurent; Self-published via Amazon * 101 Essays that change the way you think; Brianna Wiest; Audiobook -* Stop starting, start finishing; Arne Roock; Lean-Kanban University -* Eat That Frog!; Brian Tracy; Hodder Paperbacks +* Atomic Habits; James Clear; Random House Business * Staff Engineer: Leadership beyond the management track; Will Larson; Audiobook -* Coders at Work - Reflections on the craft of programming, Peter Seibel and Mitchell Dorian et al., Audiobook -* The Bullet Journal Method; Ryder Carroll; Fourth Estate -* Time Management for System Administrators; Thomas A. Limoncelli; O'Reilly -* Buddah and Einstein walk into a Bar; Guy Joseph Ale, Claire Bloom; Blackstone Publishing +* Consciousness: A Very Short Introduction; Susan Blackmore; Oxford Uiversity Press * Never Split the Difference; Chris Voss, Tahl Raz; Random House Business +* Getting Things Done; David Allen +* Solve for Happy; Mo Gawdat (RE-READ 1ST TIME) * The Good Enough Job; Simone Stolzoff; Ebury Edge -* 97 Things Every Engineering Manager Should Know; Camille Fournier; Audiobook -* So Good They Can't Ignore You; Cal Newport; Business Plus -* Soft Skills; John Sommez; Manning Publications -* Search Inside Yourself - The Unexpected path to Achieving Success, Happiness (and World Peace); Chade-Meng Tan, Daniel Goleman, Jon Kabat-Zinn; HarperOne -* Who Moved My Cheese?; Dr. Spencer Johnson; Vermilion -* Influence without Authority; A. Cohen, D. Bradford; Wiley -* Ultralearning; Scott Young; Thorsons -* The Power of Now; Eckhard Tolle; Yellow Kite -* Digital Minimalism; Cal Newport; Portofolio Penguin -* The Complete Software Developer's Career Guide; John Sonmez; Unabridged Audiobook -* Atomic Habits; James Clear; Random House Business * Eat That Frog; Brian Tracy -* Deep Work; Cal Newport; Piatkus -* The Obstacle Is The Way; Ryan Holiday; Profile Books Ltd -* The Daily Stoic; Ryan Holiday, Stephen Hanselman; Profile Books -* Getting Things Done; David Allen +* Search Inside Yourself - The Unexpected path to Achieving Success, Happiness (and World Peace); Chade-Meng Tan, Daniel Goleman, Jon Kabat-Zinn; HarperOne +* Buddah and Einstein walk into a Bar; Guy Joseph Ale, Claire Bloom; Blackstone Publishing +* Soft Skills; John Sommez; Manning Publications => ../notes/index.gmi Here are notes of mine for some of the books @@ -143,22 +143,22 @@ In random order: Some of these were in-person with exams; others were online learning lectures only. In random order: +* Structure and Interpretation of Computer Programs; Harold Abelson and more...; +* Ultimate Go Programming; Bill Kennedy; O'Reilly Online * The Ultimate Kubernetes Bootcamp; School of Devops; O'Reilly Online -* Functional programming lecture; Remote University of Hagen +* Developing IaC with Terraform (with Live Lessons); O'Reilly Online +* MySQL Deep Dive Workshop; 2-day on-site training +* AWS Immersion Day; Amazon; 1-day interactive online training +* Linux Security and Isolation APIs Training; Michael Kerrisk; 3-day on-site training * Apache Tomcat Best Practises; 3-day on-site training -* F5 Loadbalancers Training; 2-day on-site training; F5, Inc. -* Cloud Operations on AWS - Learn how to configure, deploy, maintain, and troubleshoot your AWS environments; 3-day online live training with labs; Amazon * Red Hat Certified System Administrator; Course + certification (Although I had the option, I decided not to take the next course as it is more effective to self learn what I need) -* Structure and Interpretation of Computer Programs; Harold Abelson and more...; +* Scripting Vim; Damian Conway; O'Reilly Online +* Functional programming lecture; Remote University of Hagen +* Cloud Operations on AWS - Learn how to configure, deploy, maintain, and troubleshoot your AWS environments; 3-day online live training with labs; Amazon +* Algorithms Video Lectures; Robert Sedgewick; O'Reilly Online * Protocol buffers; O'Reilly Online -* MySQL Deep Dive Workshop; 2-day on-site training +* F5 Loadbalancers Training; 2-day on-site training; F5, Inc. * The Well-Grounded Rubyist Video Edition; David. A. Black; O'Reilly Online -* Ultimate Go Programming; Bill Kennedy; O'Reilly Online -* Linux Security and Isolation APIs Training; Michael Kerrisk; 3-day on-site training -* Algorithms Video Lectures; Robert Sedgewick; O'Reilly Online -* Developing IaC with Terraform (with Live Lessons); O'Reilly Online -* Scripting Vim; Damian Conway; O'Reilly Online -* AWS Immersion Day; Amazon; 1-day interactive online training ## Technical guides @@ -174,20 +174,20 @@ These are not whole books, but guides (smaller or larger) which I found very use In random order: -* Modern Mentor -* Wednesday Wisdom -* The Changelog Podcast(s) -* Cup o' Go [Golang] +* Pratical AI +* Hidden Brain +* BSD Now [BSD] +* The ProdCast (Google SRE Podcast) * Backend Banter -* Maintainable * Dev Interrupted -* Deep Questions with Cal Newport * Fallthrough [Golang] -* The ProdCast (Google SRE Podcast) +* The Changelog Podcast(s) * Fork Around And Find Out -* BSD Now [BSD] -* Hidden Brain -* Pratical AI +* Deep Questions with Cal Newport +* Modern Mentor +* Maintainable +* Cup o' Go [Golang] +* Wednesday Wisdom * The Pragmatic Engineer Podcast ### Podcasts I liked @@ -195,36 +195,36 @@ In random order: I liked them but am not listening to them anymore. The podcasts have either "finished" (no more episodes) or I stopped listening to them due to time constraints or a shift in my interests. * Java Pub House -* Modern Mentor -* CRE: Chaosradio Express [german] -* Ship It (predecessor of Fork Around And Find Out) * FLOSS weekly * Go Time (predecessor of fallthrough) +* Ship It (predecessor of Fork Around And Find Out) +* CRE: Chaosradio Express [german] +* Modern Mentor ## Newsletters I like This is a mix of tech and non-tech newsletters I am subscribed to. In random order: -* Monospace Mentor -* Ruby Weekly -* VK Newsletter -* Golang Weekly * The Valuable Dev -* byteSizeGo -* The Pragmatic Engineer -* Register Spill -* Applied Go Weekly Newsletter * The Imperfectionist * Andreas Brandhorst Newsletter (Sci-Fi author) * Changelog News +* byteSizeGo +* The Pragmatic Engineer +* Applied Go Weekly Newsletter +* Monospace Mentor +* Register Spill +* Ruby Weekly +* Golang Weekly +* VK Newsletter ## Magazines I like(d) This is a mix of tech I like(d). I may not be a current subscriber, but now and then, I buy an issue. In random order: +* LWN (online only) * Linux Magazine * Linux User -* LWN (online only) * freeX (not published anymore) # Formal education diff --git a/gemfeed/2021-07-04-the-well-grounded-rubyist.gmi b/gemfeed/2021-07-04-the-well-grounded-rubyist.gmi index 6f2952e8..29adf905 100644 --- a/gemfeed/2021-07-04-the-well-grounded-rubyist.gmi +++ b/gemfeed/2021-07-04-the-well-grounded-rubyist.gmi @@ -118,4 +118,9 @@ Will I abandon my beloved Perl? Probably not. There are also some Perl scripts I E-Mail your comments to `paul@nospam.buetow.org` :-) +Other Ruby-related posts: + +=> ./2025-10-11-the-well-grounded-rubyist-notes.gmi 2025-10-11 Key Takeaways from The Well-Grounded Rubyist +=> ./2021-07-04-the-well-grounded-rubyist.gmi 2021-07-04 The Well-Grounded Rubyist (You are currently reading this) + => ../ Back to the main site diff --git a/gemfeed/2021-07-04-the-well-grounded-rubyist.gmi.tpl b/gemfeed/2021-07-04-the-well-grounded-rubyist.gmi.tpl index 4434f170..19bb6109 100644 --- a/gemfeed/2021-07-04-the-well-grounded-rubyist.gmi.tpl +++ b/gemfeed/2021-07-04-the-well-grounded-rubyist.gmi.tpl @@ -106,4 +106,8 @@ Will I abandon my beloved Perl? Probably not. There are also some Perl scripts I E-Mail your comments to `paul@nospam.buetow.org` :-) +Other Ruby-related posts: + +<< template::inline::rindex ruby + => ../ Back to the main site diff --git a/gemfeed/2025-10-11-the-well-grounded-rubyist-notes.gmi b/gemfeed/2025-10-11-the-well-grounded-rubyist-notes.gmi new file mode 100644 index 00000000..7539433a --- /dev/null +++ b/gemfeed/2025-10-11-the-well-grounded-rubyist-notes.gmi @@ -0,0 +1,204 @@ +# Key Takeaways from The Well-Grounded Rubyist + +> Published at 2025-10-11T15:25:14+03:00 + +Some time ago, I wrote about my journey into Ruby and how "The Well-Grounded Rubyist" helped me to get a better understanding of the language. I took a lot of notes while reading the book, and I think it's time to share some of them. This is not a comprehensive review, but rather a collection of interesting tidbits and concepts that stuck with me. + +=> ./2021-07-04-the-well-grounded-rubyist.gmi My first post about the book. + +## The Object Model + +One of the most fascinating aspects of Ruby is its object model. The book does a great job of explaining the details. + +### Everything is an object (almost) + +In Ruby, most things are objects. This includes numbers, strings, and even classes themselves. This has some interesting consequences. For example, you can't use `i++` like in C or Java. Integers are immutable objects. `1` is always the same object. `1 + 1` returns a new object, `2`. + +### The `self` keyword + +There is always a current object, `self`. If you call a method without an explicit receiver, it's called on `self`. For example, `puts "hello"` is actually `self.puts "hello"`. + +```ruby +# At the top level, self is the main object +p self +# => main +p self.class +# => Object + +def foo + # Inside a method, self is the object that received the call + p self +end + +foo +# => main +``` + +This code demonstrates how `self` changes depending on the context. At the top level, it's `main`, an instance of `Object`. When `foo` is called without a receiver, it's called on `main`. + +### Singleton Methods + +You can add methods to individual objects. These are called singleton methods. + +```ruby +obj = "a string" + +def obj.shout + self.upcase + "!" +end + +p obj.shout +# => "A STRING!" + +obj2 = "another string" +# obj2.shout would raise a NoMethodError +``` + +Here, the `shout` method is only available on the `obj` object. This is a powerful feature for adding behavior to specific instances. + +### Classes are Objects + +Classes themselves are objects, instances of the `Class` class. This means you can create classes dynamically. + +```ruby +MyClass = Class.new do + def say_hello + puts "Hello from a dynamically created class!" + end +end + +instance = MyClass.new +instance.say_hello +# => Hello from a dynamically created class! +``` + +This shows how to create a new class and assign it to a constant. This is what happens behind the scenes when you use the `class` keyword. + +## Control Flow and Methods + +The book clarified many things about how methods and control flow work in Ruby. + +### `case` and the `===` operator + +The `case` statement is more powerful than I thought. It uses the `===` (threequals or case equality) operator for comparison, not `==`. Different classes can implement `===` in their own way. + +```ruby +# For ranges, it checks for inclusion +p (1..5) === 3 # => true + +# For classes, it checks if the object is an instance of the class +p String === "hello" # => true + +# For regexes, it checks for a match +p /llo/ === "hello" # => true + +def check(value) + case value + when String + "It's a string" + when (1..10) + "It's a number between 1 and 10" + else + "Something else" + end +end + +p check(5) # => "It's a number between 1 and 10" +``` + +### Blocks and `yield` + +Blocks are a cornerstone of Ruby. You can pass them to methods to customize their behavior. The `yield` keyword is used to call the block. + +```ruby +def my_iterator + puts "Entering the method" + yield + puts "Back in the method" + yield +end + +my_iterator { puts "Inside the block" } +# Entering the method +# Inside the block +# Back in the method +# Inside the block +``` + +This simple iterator shows how `yield` transfers control to the block. You can also pass arguments to `yield` and get a return value from the block. + +```ruby +def with_return + result = yield(5) + puts "The block returned #{result}" +end + +with_return { |n| n * 2 } +# => The block returned 10 +``` + +This demonstrates passing an argument to the block and using its return value. + +## Fun with Data Types + +Ruby's core data types are full of nice little features. + +### Symbols + +Symbols are like immutable strings. They are great for keys in hashes because they are unique and memory-efficient. + +```ruby +# Two strings with the same content are different objects +p "foo".object_id +p "foo".object_id + +# Two symbols with the same content are the same object +p :foo.object_id +p :foo.object_id + +# Modern hash syntax uses symbols as keys +my_hash = { name: "Paul", language: "Ruby" } +p my_hash[:name] # => "Paul" +``` + +This code highlights the difference between strings and symbols and shows the convenient hash syntax. + +### Arrays and Hashes + +Arrays and hashes have a rich API. The `%w` and `%i` shortcuts for creating arrays of strings and symbols are very handy. + +```ruby +# Array of strings +p %w[one two three] +# => ["one", "two", "three"] + +# Array of symbols +p %i[one two three] +# => [:one, :two, :three] +``` + +A quick way to create arrays. You can also retrieve multiple values at once. + +```ruby +arr = [10, 20, 30, 40, 50] +p arr.values_at(0, 2, 4) +# => [10, 30, 50] + +hash = { a: 1, b: 2, c: 3 } +p hash.values_at(:a, :c) +# => [1, 3] +``` + +The `values_at` method is a concise way to get multiple elements. + +## Final Thoughts + +These are just a few of the many things I learned from "The Well-Grounded Rubyist". The book gave me a much deeper appreciation for the language and its design. If you are a Ruby programmer, I highly recommend it. Meanwhile, I also read the book "Programming Ruby 3.3", just I didn't have time to process my notes there yet. + +E-Mail your comments to `paul@nospam.buetow.org` :-) + +Other Ruby-related posts: + +=> ./2021-07-04-the-well-grounded-rubyist.gmi 2021-07-04 The Well-Grounded Rubyist + +=> ../ Back to the main site diff --git a/gemfeed/2025-10-11-the-well-grounded-rubyist-notes.gmi.tpl b/gemfeed/2025-10-11-the-well-grounded-rubyist-notes.gmi.tpl new file mode 100644 index 00000000..eb56860e --- /dev/null +++ b/gemfeed/2025-10-11-the-well-grounded-rubyist-notes.gmi.tpl @@ -0,0 +1,204 @@ +# Key Takeaways from The Well-Grounded Rubyist + +> Published at 2025-10-11T15:25:14+03:00 + +Some time ago, I wrote about my journey into Ruby and how "The Well-Grounded Rubyist" helped me to get a better understanding of the language. I took a lot of notes while reading the book, and I think it's time to share some of them. This is not a comprehensive review, but rather a collection of interesting tidbits and concepts that stuck with me. + +=> ./2021-07-04-the-well-grounded-rubyist.gmi My first post about the book. + +## The Object Model + +One of the most fascinating aspects of Ruby is its object model. The book does a great job of explaining the details. + +### Everything is an object (almost) + +In Ruby, most things are objects. This includes numbers, strings, and even classes themselves. This has some interesting consequences. For example, you can't use `i++` like in C or Java. Integers are immutable objects. `1` is always the same object. `1 + 1` returns a new object, `2`. + +### The `self` keyword + +There is always a current object, `self`. If you call a method without an explicit receiver, it's called on `self`. For example, `puts "hello"` is actually `self.puts "hello"`. + +```ruby +# At the top level, self is the main object +p self +# => main +p self.class +# => Object + +def foo + # Inside a method, self is the object that received the call + p self +end + +foo +# => main +``` + +This code demonstrates how `self` changes depending on the context. At the top level, it's `main`, an instance of `Object`. When `foo` is called without a receiver, it's called on `main`. + +### Singleton Methods + +You can add methods to individual objects. These are called singleton methods. + +```ruby +obj = "a string" + +def obj.shout + self.upcase + "!" +end + +p obj.shout +# => "A STRING!" + +obj2 = "another string" +# obj2.shout would raise a NoMethodError +``` + +Here, the `shout` method is only available on the `obj` object. This is a powerful feature for adding behavior to specific instances. + +### Classes are Objects + +Classes themselves are objects, instances of the `Class` class. This means you can create classes dynamically. + +```ruby +MyClass = Class.new do + def say_hello + puts "Hello from a dynamically created class!" + end +end + +instance = MyClass.new +instance.say_hello +# => Hello from a dynamically created class! +``` + +This shows how to create a new class and assign it to a constant. This is what happens behind the scenes when you use the `class` keyword. + +## Control Flow and Methods + +The book clarified many things about how methods and control flow work in Ruby. + +### `case` and the `===` operator + +The `case` statement is more powerful than I thought. It uses the `===` (threequals or case equality) operator for comparison, not `==`. Different classes can implement `===` in their own way. + +```ruby +# For ranges, it checks for inclusion +p (1..5) === 3 # => true + +# For classes, it checks if the object is an instance of the class +p String === "hello" # => true + +# For regexes, it checks for a match +p /llo/ === "hello" # => true + +def check(value) + case value + when String + "It's a string" + when (1..10) + "It's a number between 1 and 10" + else + "Something else" + end +end + +p check(5) # => "It's a number between 1 and 10" +``` + +### Blocks and `yield` + +Blocks are a cornerstone of Ruby. You can pass them to methods to customize their behavior. The `yield` keyword is used to call the block. + +```ruby +def my_iterator + puts "Entering the method" + yield + puts "Back in the method" + yield +end + +my_iterator { puts "Inside the block" } +# Entering the method +# Inside the block +# Back in the method +# Inside the block +``` + +This simple iterator shows how `yield` transfers control to the block. You can also pass arguments to `yield` and get a return value from the block. + +```ruby +def with_return + result = yield(5) + puts "The block returned #{result}" +end + +with_return { |n| n * 2 } +# => The block returned 10 +``` + +This demonstrates passing an argument to the block and using its return value. + +## Fun with Data Types + +Ruby's core data types are full of nice little features. + +### Symbols + +Symbols are like immutable strings. They are great for keys in hashes because they are unique and memory-efficient. + +```ruby +# Two strings with the same content are different objects +p "foo".object_id +p "foo".object_id + +# Two symbols with the same content are the same object +p :foo.object_id +p :foo.object_id + +# Modern hash syntax uses symbols as keys +my_hash = { name: "Paul", language: "Ruby" } +p my_hash[:name] # => "Paul" +``` + +This code highlights the difference between strings and symbols and shows the convenient hash syntax. + +### Arrays and Hashes + +Arrays and hashes have a rich API. The `%w` and `%i` shortcuts for creating arrays of strings and symbols are very handy. + +```ruby +# Array of strings +p %w[one two three] +# => ["one", "two", "three"] + +# Array of symbols +p %i[one two three] +# => [:one, :two, :three] +``` + +A quick way to create arrays. You can also retrieve multiple values at once. + +```ruby +arr = [10, 20, 30, 40, 50] +p arr.values_at(0, 2, 4) +# => [10, 30, 50] + +hash = { a: 1, b: 2, c: 3 } +p hash.values_at(:a, :c) +# => [1, 3] +``` + +The `values_at` method is a concise way to get multiple elements. + +## Final Thoughts + +These are just a few of the many things I learned from "The Well-Grounded Rubyist". The book gave me a much deeper appreciation for the language and its design. If you are a Ruby programmer, I highly recommend it. Meanwhile, I also read the book "Programming Ruby 3.3", just I didn't have time to process my notes there yet. + +E-Mail your comments to `paul@nospam.buetow.org` :-) + +Other Ruby-related posts: + +<< template::inline::rindex ruby + +=> ../ Back to the main site diff --git a/gemfeed/atom.xml b/gemfeed/atom.xml index 68a3a2cc..264191d1 100644 --- a/gemfeed/atom.xml +++ b/gemfeed/atom.xml @@ -1,11 +1,255 @@ - 2025-10-02T11:30:14+03:00 + 2025-10-11T15:25:15+03:00 foo.zone feed To be in the .zone! gemini://foo.zone/ + + Key Takeaways from The Well-Grounded Rubyist + + gemini://foo.zone/gemfeed/2025-10-11-the-well-grounded-rubyist-notes.gmi + 2025-10-11T15:25:14+03:00 + + Paul Buetow aka snonux + paul@dev.buetow.org + + Some time ago, I wrote about my journey into Ruby and how 'The Well-Grounded Rubyist' helped me to get a better understanding of the language. I took a lot of notes while reading the book, and I think it's time to share some of them. This is not a comprehensive review, but rather a collection of interesting tidbits and concepts that stuck with me. + +
+

Key Takeaways from The Well-Grounded Rubyist


+
+Some time ago, I wrote about my journey into Ruby and how "The Well-Grounded Rubyist" helped me to get a better understanding of the language. I took a lot of notes while reading the book, and I think it's time to share some of them. This is not a comprehensive review, but rather a collection of interesting tidbits and concepts that stuck with me.
+
+My first post about the book.
+
+

The Object Model


+
+One of the most fascinating aspects of Ruby is its object model. The book does a great job of explaining the details.
+
+

Everything is an object (almost)


+
+In Ruby, most things are objects. This includes numbers, strings, and even classes themselves. This has some interesting consequences. For example, you can't use i++ like in C or Java. Integers are immutable objects. 1 is always the same object. 1 + 1 returns a new object, 2.
+
+

The self keyword


+
+There is always a current object, self. If you call a method without an explicit receiver, it's called on self. For example, puts "hello" is actually self.puts "hello".
+
+ +
# At the top level, self is the main object
+p self
+# => main
+p self.class
+# => Object
+
+def foo
+  # Inside a method, self is the object that received the call
+  p self
+end
+
+foo
+# => main
+
+
+This code demonstrates how self changes depending on the context. At the top level, it's main, an instance of Object. When foo is called without a receiver, it's called on main.
+
+

Singleton Methods


+
+You can add methods to individual objects. These are called singleton methods.
+
+ +
obj = "a string"
+
+def obj.shout
+  self.upcase + "!"
+end
+
+p obj.shout
+# => "A STRING!"
+
+obj2 = "another string"
+# obj2.shout would raise a NoMethodError
+
+
+Here, the shout method is only available on the obj object. This is a powerful feature for adding behavior to specific instances.
+
+

Classes are Objects


+
+Classes themselves are objects, instances of the Class class. This means you can create classes dynamically.
+
+ +
MyClass = Class.new do
+  def say_hello
+    puts "Hello from a dynamically created class!"
+  end
+end
+
+instance = MyClass.new
+instance.say_hello
+# => Hello from a dynamically created class!
+
+
+This shows how to create a new class and assign it to a constant. This is what happens behind the scenes when you use the class keyword.
+
+

Control Flow and Methods


+
+The book clarified many things about how methods and control flow work in Ruby.
+
+

case and the === operator


+
+The case statement is more powerful than I thought. It uses the === (threequals or case equality) operator for comparison, not ==. Different classes can implement === in their own way.
+
+ +
# For ranges, it checks for inclusion
+p (1..5) === 3 # => true
+
+# For classes, it checks if the object is an instance of the class
+p String === "hello" # => true
+
+# For regexes, it checks for a match
+p /llo/ === "hello" # => true
+
+def check(value)
+  case value
+  when String
+    "It's a string"
+  when (1..10)
+    "It's a number between 1 and 10"
+  else
+    "Something else"
+  end
+end
+
+p check(5) # => "It's a number between 1 and 10"
+
+
+

Blocks and yield


+
+Blocks are a cornerstone of Ruby. You can pass them to methods to customize their behavior. The yield keyword is used to call the block.
+
+ +
def my_iterator
+  puts "Entering the method"
+  yield
+  puts "Back in the method"
+  yield
+end
+
+my_iterator { puts "Inside the block" }
+# Entering the method
+# Inside the block
+# Back in the method
+# Inside the block
+
+
+This simple iterator shows how yield transfers control to the block. You can also pass arguments to yield and get a return value from the block.
+
+ +
def with_return
+  result = yield(5)
+  puts "The block returned #{result}"
+end
+
+with_return { |n| n * 2 }
+# => The block returned 10
+
+
+This demonstrates passing an argument to the block and using its return value.
+
+

Fun with Data Types


+
+Ruby's core data types are full of nice little features.
+
+

Symbols


+
+Symbols are like immutable strings. They are great for keys in hashes because they are unique and memory-efficient.
+
+ +
# Two strings with the same content are different objects
+p "foo".object_id
+p "foo".object_id
+
+# Two symbols with the same content are the same object
+p :foo.object_id
+p :foo.object_id
+
+# Modern hash syntax uses symbols as keys
+my_hash = { name: "Paul", language: "Ruby" }
+p my_hash[:name] # => "Paul"
+
+
+This code highlights the difference between strings and symbols and shows the convenient hash syntax.
+
+

Arrays and Hashes


+
+Arrays and hashes have a rich API. The %w and %i shortcuts for creating arrays of strings and symbols are very handy.
+
+ +
# Array of strings
+p %w[one two three]
+# => ["one", "two", "three"]
+
+# Array of symbols
+p %i[one two three]
+# => [:one, :two, :three]
+
+
+A quick way to create arrays. You can also retrieve multiple values at once.
+
+ +
arr = [10, 20, 30, 40, 50]
+p arr.values_at(0, 2, 4)
+# => [10, 30, 50]
+
+hash = { a: 1, b: 2, c: 3 }
+p hash.values_at(:a, :c)
+# => [1, 3]
+
+
+The values_at method is a concise way to get multiple elements.
+
+

Final Thoughts


+
+These are just a few of the many things I learned from "The Well-Grounded Rubyist". The book gave me a much deeper appreciation for the language and its design. If you are a Ruby programmer, I highly recommend it. Meanwhile, I also read the book "Programming Ruby 3.3", just I didn't have time to process my notes there yet.
+
+E-Mail your comments to paul@nospam.buetow.org :-)
+
+Other Ruby-related posts:
+
+2021-07-04 The Well-Grounded Rubyist
+
+Back to the main site
+
+
+
f3s: Kubernetes with FreeBSD - Part 7: k3s and first pod deployments @@ -14027,147 +14271,6 @@ DC on fire:
E-Mail your comments to paul@nospam.buetow.org :-)

-Back to the main site
- - -
- - Gemtexter 2.1.0 - Let's Gemtext again³ - - gemini://foo.zone/gemfeed/2023-07-21-gemtexter-2.1.0-lets-gemtext-again-3.gmi - 2023-07-21T10:19:31+03:00 - - Paul Buetow aka snonux - paul@dev.buetow.org - - I proudly announce that I've released Gemtexter version `2.1.0`. What is Gemtexter? It's my minimalist static site generator for Gemini Gemtext, HTML and Markdown, written in GNU Bash. - -
-

Gemtexter 2.1.0 - Let's Gemtext again³


-
-Published at 2023-07-21T10:19:31+03:00
-
-I proudly announce that I've released Gemtexter version 2.1.0. What is Gemtexter? It's my minimalist static site generator for Gemini Gemtext, HTML and Markdown, written in GNU Bash.
-
-https://codeberg.org/snonux/gemtexter
-
-
--=[ typewriters ]=-  1/98
-                                        .-------.
-       .-------.                       _|~~ ~~  |_
-      _|~~ ~~  |_       .-------.    =(_|_______|_)
-    =(_|_______|_)=    _|~~ ~~  |_     |:::::::::|
-      |:::::::::|    =(_|_______|_)    |:::::::[]|
-      |:::::::[]|      |:::::::::|     |o=======.|
-      |o=======.|      |:::::::[]|     `"""""""""`
- jgs  `"""""""""`      |o=======.|
-  mod. by Paul Buetow  `"""""""""`
-
-
-

Table of Contents


-
-
-

Why Bash?


-
-This project is too complex for a Bash script. Writing it in Bash was to try out how maintainable a "larger" Bash script could be. It's still pretty maintainable and helps me try new Bash tricks here and then!
-
-Let's list what's new!
-
-

Switch to GPL3 license


-
-Many (almost all) of the tools and commands (GNU Bash, GMU Sed, GNU Date, GNU Grep, GNU Source Highlight) used by Gemtexter are licensed under the GPL anyway. So why not use the same? This was an easy switch, as I was the only code contributor so far!
-
-

Source code highlighting support


-
-The HTML output now supports source code highlighting, which is pretty neat if your site is about programming. The requirement is to have the source-highlight command, which is GNU Source Highlight, to be installed. Once done, you can annotate a bare block with the language to be highlighted. E.g.:
-
-
- ```bash
- if [ -n "$foo" ]; then
-   echo "$foo"
- fi
- ```
-
-
-The result will look like this (you can see the code highlighting only in the Web version, not in the Geminispace version of this site):
-
- -
if [ -n "$foo" ]; then
-  echo "$foo"
-fi
-
-
-Please run source-highlight --lang-list for a list of all supported languages.
-
-

HTML exact variant


-
-Gemtexter is there to convert your Gemini Capsule into other formats, such as HTML and Markdown. An HTML exact variant can now be enabled in the gemtexter.conf by adding the line declare -rx HTML_VARIANT=exact. The HTML/CSS output changed to reflect a more exact Gemtext appearance and to respect the same spacing as you would see in the Geminispace.
-
-

Use of Hack webfont by default


-
-The Hack web font is a typeface designed explicitly for source code. It's a derivative of the Bitstream Vera and DejaVu Mono lineage, but it features many improvements and refinements that make it better suited to reading and writing code.
-
-The font has distinctive glyphs for every character, which helps to reduce confusion between similar-looking characters. For example, the characters "0" (zero), "O" (capital o), and "o" (lowercase o), or "1" (one), "l" (lowercase L), and "I" (capital i) all have distinct looks in Hack, making it easier to read and understand code at a glance.
-
-Hack is open-source and freely available for use and modification under the MIT License.
-
-

HTML Mastodon verification support


-
-The following link explains how URL verification works in Mastodon:
-
-https://joinmastodon.org/verification
-
-So we have to hyperlink to the Mastodon profile to be verified and also to include a rel='me' into the tag. In order to do that add this to the gemtexter.conf (replace the URI to your Mastodon profile accordingly):
-
- -
declare -xr MASTODON_URI='https://fosstodon.org/@snonux'
-
-
-and add the following into your index.gmi:
-
-
-=> https://fosstodon.org/@snonux Me at Mastodon
-
-
-The resulting line in the HTML output will be something as follows:
-
- -
<a href='https://fosstodon.org/@snonux' rel='me'>Me at Mastodon</a>
-
-
-

More


-
-Additionally, there were a couple of bug fixes, refactorings and overall improvements in the documentation made.
-
-E-Mail your comments to paul@nospam.buetow.org :-)
-
-Other related posts are:
-
-2024-10-02 Gemtexter 3.0.0 - Let's Gemtext again⁴
-2023-07-21 Gemtexter 2.1.0 - Let's Gemtext again³ (You are currently reading this)
-2023-03-25 Gemtexter 2.0.0 - Let's Gemtext again²
-2022-08-27 Gemtexter 1.1.0 - Let's Gemtext again
-2021-06-05 Gemtexter - One Bash script to rule it all
-2021-04-24 Welcome to the Geminispace
-
Back to the main site
diff --git a/gemfeed/index.gmi b/gemfeed/index.gmi index d51a5bcd..48f4ae97 100644 --- a/gemfeed/index.gmi +++ b/gemfeed/index.gmi @@ -2,6 +2,7 @@ ## To be in the .zone! +=> ./2025-10-11-the-well-grounded-rubyist-notes.gmi 2025-10-11 - Key Takeaways from The Well-Grounded Rubyist => ./2025-10-02-f3s-kubernetes-with-freebsd-part-7.gmi 2025-10-02 - f3s: Kubernetes with FreeBSD - Part 7: k3s and first pod deployments => ./2025-09-14-bash-golf-part-4.gmi 2025-09-14 - Bash Golf Part 4 => ./2025-08-15-random-weird-things-iii.gmi 2025-08-15 - Random Weird Things - Part Ⅲ diff --git a/index.gmi b/index.gmi index a1a0f2f9..5dfb4a49 100644 --- a/index.gmi +++ b/index.gmi @@ -1,6 +1,6 @@ # Hello! -> This site was generated at 2025-10-11T13:34:49+03:00 by `Gemtexter` +> This site was generated at 2025-10-11T15:25:15+03:00 by `Gemtexter` Welcome to the foo.zone! @@ -38,6 +38,7 @@ Everything you read on this site is my personal opinion and experience. You can ### Posts +=> ./gemfeed/2025-10-11-the-well-grounded-rubyist-notes.gmi 2025-10-11 - Key Takeaways from The Well-Grounded Rubyist => ./gemfeed/2025-10-02-f3s-kubernetes-with-freebsd-part-7.gmi 2025-10-02 - f3s: Kubernetes with FreeBSD - Part 7: k3s and first pod deployments => ./gemfeed/2025-09-14-bash-golf-part-4.gmi 2025-09-14 - Bash Golf Part 4 => ./gemfeed/2025-08-15-random-weird-things-iii.gmi 2025-08-15 - Random Weird Things - Part Ⅲ diff --git a/uptime-stats.gmi b/uptime-stats.gmi index 9923aa6e..5c8b2595 100644 --- a/uptime-stats.gmi +++ b/uptime-stats.gmi @@ -1,6 +1,6 @@ # My machine uptime stats -> This site was last updated at 2025-10-11T13:34:49+03:00 +> This site was last updated at 2025-10-11T15:25:15+03:00 The following stats were collected via `uptimed` on all of my personal computers over many years and the output was generated by `guprecords`, the global uptime records stats analyser of mine. -- cgit v1.2.3