Skip to content

Latest commit

 

History

History
159 lines (136 loc) · 5.8 KB

ruby.md

File metadata and controls

159 lines (136 loc) · 5.8 KB
title description published date tags editor dateCreated
ruby
true
2023-07-22 17:43:52 UTC
markdown
2023-07-22 17:43:49 UTC

Ruby

Related: Sketchup + Ruby | VS Code | WSL

Contents:


Docs


Dev tools


Learning resources


Hubs


Other stuff

Troubleshooting Solargraph:

  • See setup log in WSL.md

Code:

introspection:

  • BasicObject
  • Class
    • #superclass
  • Method
    • #inspect
    • #name
    • #original_name
    • #owner
    • #parameters
    • #receiver
    • #source_location
    • #super_method
  • Module
    • #ancestors
    • #included_modules
    • #inspect
    • #nesting
  • Object
    • #class
    • #inspect
    • #instance_variables
    • #instance_variable_defined?args: (symbol) or (string)
    • #methods
    • #respond_to?

pattern-matching:

feature intro (ruby 2.7)

unsorted:

  • * - splat / star -
  • <=> - operator: combined comparison
  • Proc
  • lambda
  • Struct - class constructor
  • super
    • e.g. good practice when inheriting from a class, to use in initialize to inherit the parent's initialize
  • #inject
  • #map
  • & shortcut
  • method
  • #dup
  • #clone
  • #==
  • #equal? or #eql?
  • class_eval
  • begin / end - Way of defining a bunch of code that needs to run on it’s own, in its own context... Whatever is the last expression that is evaluated in the begin end block is the result that will be returned..
    • Can be helpful for defining chunks of code that need to execute in a certain order
    • article 1, article 2
  • rescue
  • ensure
  • ||=
  • #method_missing
  • Exception - article
  • singleton / eigenclass
  • Golden Rule of metaprogramming (dave thomas):
    • Instance variables: look up in self
    • Methods: look up in self's class
  • Module: ObjectSpace