How do I parse an HTML table with Nokogiri?

I installed Ruby and Mechanize. It seems to me that it is posible in Nokogiri to do what I want to do but I do not know how to do it. What about this table? It is just part of the HTML of a vBulletin forum site. I tried to keep the HTML structure but […]

Ruby: hooks for methods

I want to find a gem or to write a code that implements hooks for methods. class A include SomeModule before_hook :meth, lambda { puts ‘bla’ } def meth puts ‘meth’ end end # => “bla\nmeth\n” I am using Rails and I know about callbacks and filters but meth isn’t an action I don’t […]

rbenv not changing ruby version

I installed rbenv according to the github directions. I am running OSX but I have tried this on a Ubuntu 12.04 VM and got the same results. The following is what i get in my terminal when I try to change ruby versions: rbenv versions * 1.9.3-p0 (set by /Users/user/.rbenv/version) 1.9.3-p125 rbenv global 1.9.3-p0 rbenv […]

Bootstrap Grid System Not Having Desired Effect

I recently started using Bootstrap on an old Rails project. I’m using the grid system to align the main content and the sidebar. Below is a code snippet from a file (index.html.erb) in my “view” folder. <div class=”container-fluid”> <div class=”row”> <div class=”col-md-8″> <div id=”featured_gallery” class=”wide_content_box rounded_border”> <%= content_tag :div do %> <%= content_tag :span, :class […]

How do I use Mechanize to process JavaScript?

I’m connecting to a web site, logging in. The website redirects me to new pages and Mechanize deals with all cookie and redirection jobs, but, I can’t get the last page. I used Firebug and did same job again and saw that there are two more pages I had to pass with Mechanize. I took […]

How do I get the match data for all occurrences of a Ruby regular expression in a string?

I need the MatchData for each occurrence of a regular expression in a string. This is different than the scan method suggested in Match All Occurrences of a Regex, since that only gives me an array of strings (I need the full MatchData, to get begin and end information, etc). input = “abc12def34ghijklmno567pqrs” numbers = […]

What does map(&:name) mean in Ruby?

I found this code in a RailsCast: def tag_names @tag_names ||‘ ‘) end What does the (&:name) in map(&:name) mean?

“Application must run” requirement for Ruby assignment, create gem?

EDIT: In short, what do I need to do to create a running application in Ruby, do I need to create a gem? ORIGINAL QUESTION THAT SUCKED: I’ve never taken any programming classes, or had assignments before so I’m asking this question in hopes this is clear to someone who has had many programming assignments […]

Truncate String from html string

I need to truncate some data received from a URI:PARSE…it is full of html codes and data, The result at the end is what I need. Here’s the string (abbreviated) ‘ junk“Result”>Q8:0;junk What’s is the best way to truncate the extra stuff in the string so that I can split the data I need into […]

can't run install or have list of gems in ruby or even know their version

I can’t use any command on gem,after downloading ruby and the gems package,i use the list command gem list but i got a problem undefined local variable or method ‘list’.

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