Questions tagged [ruby-std]

Ruby's std-lib is the Ruby Standard Library class collection. Use it with the [ruby] tag.

In Ruby, std-lib is the Ruby Standard Library class collection that are not included by default in Ruby's core, so it's required to be included into the app explicitly with the ::require method.

You can see the full documentation on and at the Ruby documentation page.

8 questions
6
votes
2 answers

Where is the ruby standard library directory placed on a Mac?

I want to read some ruby code. And I think this is the good place to start dig in. But I cant find it.
Yury Kaspiarovich
  • 2,027
  • 2
  • 19
  • 25
4
votes
1 answer

Why SortedSet was removed from stdlib in Ruby 3.0?

That was a very surprising finding when I switched my app to Ruby3+ version. Even though it is a major version upgrade but still.. Removal of Core data type from stdlib that's been there for at least 10 years(since 1.9.3?) looks weird. Was there any…
BinaryButterfly
  • 18,137
  • 13
  • 50
  • 91
2
votes
1 answer

Forwarding/delegating 2 arguments in ruby

class MyClass extend Forwardable def_delegators :@broker, :add def subscribe_in_broker @subscribers.map(&method(:add)) end end In this example @subscribers is a Hash and @broker.add takes two arguments: def broker(k,v). This causes…
2
votes
1 answer

Adding extensions to a stdlib class in a ruby on rails project

where would I place additions to stdlib classes in a rails project? Let's say something like: class Date def foo 'foo' end end I thought about the initializer folder but it somehow felt wrong. Ideas?
Frank
  • 23
  • 2
2
votes
1 answer

How do I require and use a library from the Ruby Standard Library such as DateTime?

How do I require and use a library from the Ruby Standard Library such as DateTime? I'm using rvm. I created a new project and specified which version of Ruby I'd like (in this case 2.1.0) and gave the project its own Gemset. mkdir proj cd proj rvm…
franksort
  • 3,093
  • 2
  • 19
  • 27
1
vote
1 answer

Is there a Ruby equivalent to the C++ std::setw(int) function?

I am outputting some text tables to a terminal and would like to be able to use something like the C++ std::setw() function to provide padding for my output rather than guessing at the number of spaces or tabs required. Before I go knock together…
TafT
  • 2,764
  • 6
  • 33
  • 51
0
votes
1 answer

How to use the Ruby stdlib profiler with Jruby?

I am trying to use Ruby's standard lib profiler, and I am not using ruby-prof because this is a jruby project. Though, I am allways getting something like: % cumulative self self total time seconds seconds calls …
Pedro Rolo
  • 28,273
  • 12
  • 60
  • 94
-1
votes
2 answers

Variable expansion in exec from the ruby standard library

What's the correct quoting syntax to allow for variable expansion in the following script? ARGF.each do |l| exec cp #{l} #{l}.bk end Thanks
Andrew
  • 737
  • 2
  • 8
  • 24