Skip to content

Instantly share code, notes, and snippets.

View novikserg's full-sized avatar

Sergei Novik novikserg

  • Amsterdam
View GitHub Profile
@novikserg
novikserg / test.rb
Last active March 15, 2018 18:40
Multiple attr_readers in Ruby
class FooBar
attr_reader :a, :b
def initialize
@a = 1
@b = 2
@c = 3
end
def see_the_c
class Foo
MY_CONST = "hello".freeze
end
puts Foo::MY_CONST # "hello"
Foo.const_set("MY_CONST", "new const")
puts Foo::MY_CONST # "new const"
class Foo
def self.my_const
require "thwait"
class Job; end
module Processor
def self.perform(worker_count, jobs)
workers = worker_count.times.map do
Thread.new do
while job = jobs.pop
yield job