Is it ok to use `any?` to check if an array is not empty?
Is it bad to check if an array is not empty by using any? method? a = [1,2,3] a.any? => true a.clear a.any? … Read more
Is it bad to check if an array is not empty by using any? method? a = [1,2,3] a.any? => true a.clear a.any? … Read more
When launching Guard, I’m getting this output: $ guard WARN: Unresolved specs during Gem::Specification.reset: lumberjack (>= 1.0.2) ffi (>= 0.5.0) WARN: Clearing out … Read more
Convert this Array: a = [“item 1”, “item 2”, “item 3”, “item 4”] …to a Hash: { “item 1” => “item 2”, “item … Read more
<%if @item.rigged %>Yes<%else%>No<%end%> I was thinking of something like this? if @item.rigged ? “Yes” : “No” But it doesn’t work. Ruby has the … Read more
Is there a one line function call that quits the program and displays a message? I know in Perl it’s as simple as: … Read more
And when would you use one rather than the other? 8 Answers 8
Is there a built in way to convert an integer in Ruby into its hexadecimal equivalent? Something like the opposite of String#to_i: “0A”.to_i(16) … Read more
Are there certain code conventions when documenting ruby code? For example I have the following code snippet: require ‘open3’ module ProcessUtils # Runs … Read more
Does Ruby have a some_string.starts_with(“abc”) method that’s built in? 4 Answers 4
I just had a quick question regarding loops in Ruby. Is there a difference between these two ways of iterating through a collection? … Read more