Skip to content

Instantly share code, notes, and snippets.

View woarewe's full-sized avatar
🎯
Focusing

Rostislav Zhuravsky woarewe

🎯
Focusing
View GitHub Profile
# frozen_string_literal: true
class Human
# What does this mean? Who is owner of this instance variable?
@created_humans = []
@@humans_count = 0
# What does mean this instruction
class << self
attr_accessor :created_humans
@woarewe
woarewe / app.rb
Created November 21, 2019 14:44
Frozen string literal magic comment investigation
require_relative 'lib'
str = 'string'
p Str.call.equal?(str) # Try to predict result and than add # frozen_string_literal: true and run app.rb
# This change breaks ruby 2.7 REPL a.k.a IRB.
# Reason is here https://github.com/ruby/irb/issues/64
class Symbol
def to_proc(*args)
proc {}
end
end
require 'rails_helper'
class Person
attr_reader(
:first_name,
:last_name,
:age,
:country
)