Abhishek Yadav
ரூபீ ப்ரோக்ராமர்
Co-organizer: Chennai.rb
h = { a: 2,
b: { x: 20, y: 30 },
c: { m: { today: :me, tomorrow: :you },
n: :hello }}
h.dig(:c, :m, :today) # => :me
h.dig(:a, :m, :today) # => nil
A = Struct.new(:foo)
a = [A.new(20), nil].sample
## earlier
b = a && a.foo
## Now
b = a&.foo
(safe navigation operator)
h = { a: 2,
b: { x: 20, y: 30 },
c: { m: { today: :me, tomorrow: :you },
n: "hello" }
}
h.fetch_values(:a, :b) # => [2, {:x=>20, :y=>30}]
Classy.new
NameError: uninitialized constant Classy
Did you mean? Class
list = ['Ruby', 'Elixir', 'Python']
list.grep(/y/)
list.grep_v(/y/)
h = { a: 2, b: 3, c: 4}
[:b, :c].map(&h) #=> [2, 3]
# frozen_string_literal: true
str = 'hello'
str[0] = 'H' #=> RuntimeError: can't modify frozen String
RubyVM::InstructionSequence#to_binary_format
RubyVM::InstructionSequence.from_binary_format(data)
Goal: machine dependent binaries:
Abhishek Yadav
ரூபீ ப்ரோக்ராமர்
Co-organizer: Chennai.rb