Access variables programmatically by name in Ruby

I’m not entirely sure if this is possible in Ruby, but hopefully there’s an easy way to do this. I want to declare a variable and later find out the name of the variable. That is, for this simple snippet: foo = [“goo”, “baz”] How can I get the name of the array (here, “foo”) […]

what is ruby-LDAP , what are its applications?

I am just about to finish my ruby book , quite stuck on LDAP topic. Does it require a server (localhost/active on internet) what is it for ?

What do you call the -> operator in Ruby?

What do you call the -> operator as in the following? ->(…) do … end Aren’t the following snippets equivalent? succ = ->(x) {x + 1} succ = lambda {|x| x + 1}

Ruby features vs Java

I am a Java programmer using Ruby for the first time, and I have a few questions about how some features compare between the two languages. Is the notion of a constructor relevant in Ruby? If yes, how does the behavior compare to Java constructors? In Java, we generally keep separate .java files for different […]

puppet 3.8 community – how to install gems for master

We’re looking to use the deep_merge functionality, but the documentation says we need to install the gem through gem install deep_merge but also that we need to do a puppetserver gem install deep_merge. Given that we’re not running PE so don’t have the puppetserver command, how can I install the gem?

Avatar rails generator

I am trying to find some rails gem or any API delivering some random (non figurative) picture for avatar users, as the one that SO uses. I tried gravatar but when I create some random hash and that I call the api via{hash}, I always get the same default image (independently of the hash) […]

How does Array#sort work when a block is passed?

I am having a problem understanding how array.sort{ |x,y| block } works exactly, hence how to use it? An example from Ruby documentation: a = [ “d”, “a”, “e”, “c”, “b” ] a.sort #=> [“a”, “b”, “c”, “d”, “e”] a.sort { |x,y| y <=> x } #=> [“e”, “d”, “c”, “b”, “a”]

Ruby function to remove all white spaces?

What is the Ruby function to remove all white space? Kind of like php’s trim()?

How do I encode/decode HTML entities in Ruby?

I am trying to decode some HTML entities, such as ‘&amp;lt;’ becoming ‘<‘. I have an old gem (html_helpers) but it seems to have been abandoned twice. Any recommendations? I will need to use it in a model.

Use HTML instead of HAML with Ruby on Rails Happy Seed

How can I use html.erb instead of haml when using a rails application that is generated using happy seed?

Ruby is the best programming language in the world - Ruby on Rails.