This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
How do I find gems that depend on a given gem?
I want to find out which gems depend on e.g. one of my gems, so i can see if i would break anything, is this supported/possible ?
gem-dependent tells you...
Related
This question already has answers here:
What does map(&:name) mean in Ruby?
(17 answers)
Closed 12 months ago.
This is from a solution I saw at a competitive programming site:
gets.split.map &:to_i
The &:to_i phrase seems to be equivalent to {|s| s.to_i}, but I can't find anything about that syntax at ruby-doc.org, or a match for "&:" [ruby] here. (I don't know what to call it for an English language search, either.)
If it matters, that site is using Ruby 3.0.1.
It's an example of Symbol#to_proc - see https://www.brianstorti.com/understanding-ruby-idiom-map-with-symbol/ for a more detailed explanation, or the ruby API documentation
This question already has answers here:
Extract data from HTML Table with mechanize
(3 answers)
Closed 7 years ago.
For example, I only want "1:30pm" from this data that I got using xpath:
"1:30pm Manila Bulletin"
One way to accomplish it is "1:30pm Manila Bulletin".split(/\s/).first.
This question already has answers here:
Split string into equal slices/chunks
(2 answers)
Closed 7 years ago.
I was wondering how I could program something to split a string into blocks of five using Ruby. Help much appreciated.
You can use String#scan method to achieve it. E.g 'string_test'.scan(/.{1,5}/)
This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Get list of a class' methods
Suppose I haven't any reference on hand, and I want to see all the methods in the built-in File class, is that simply available?
---------------------------EDIT---------------------------
answered in Get list of a class' instance methods
Sure, try:
File.methods
And if you have the awesome_print gem installed then it formats the list nicely and provides extra information.
This question already has answers here:
Closed 11 years ago.
Possible Duplicates:
Double colons rails
What does :: do?
I was reading a manual on Rails and came across this snippet:
match 'rocketeer.js' => ::TestRoutingMapper::RocketeerApp
I'd never seen the :: syntax at the head of a class name before. I'm wondering what is the significance of writing it this way.
See my answer to What does :: do?