singleton_class.rb
Ruby•Expert
Explorer
C40
C++40
C#40
Dart40
Go40
Java40
JavaScript40
Kotlin40
Objective-C40
Perl40
PHP40
Python40
R40
Ruby
Beginner10
Intermediate10
Advanced10
Expert5
singleton_class.rb
metaprogramming.rb
fiber_async.rb
method_missing.rb
module_prepend.rb
Master5
Rust40
Shell40
Swift40
TypeScript40
singleton_class.rb
Click to focus
1
2
3
4
5
6
7
8
9
10
class Database↵
include Singleton↵
attr_reader :connection↵
def initialize↵
@connection = establish_connection(ENV['DB_URL'])↵
end↵
def self.query(sql)↵
instance.connection.execute(sql)↵
end↵
end
0WPM•0%•0:00•0/198(0%)|Ln 1, Col 1
UTF-8•Ruby