Hi Guys,
I have just started learning Ruby. Very cool language, liking it a lot.
I am using the very handy Hpricot HTML parser.
What I am looking to do is grab all the text from the page, excluding the HTML tags.
Example:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Data Protectio...
I want to read some ruby code. And I think this is the good place to start dig in. But I cant find it.
...
I am completely new to Ruby. All I want is to produce a simple XML file.
<?xml version="1.0" encoding="ASCII"?>
<product>
<name>Test</name>
</product>
That's it.
...
Hi, I have created Rails database using the following schema:
ActiveRecord::Schema.define(:version => 20090807141407) do
create_table "trunks", :force => true do |t|
t.integer "npa"
t.integer "nxxFrom"
t.integer "nxxTo"
t.string "trnk"
t.datetime "created_at"
t.datetime "updated_at"
end
end
In my CSV...
I'm looking for a CMS writen in Ruby and not based on Ruby on Rails, are there some projects?
...
I'm sure this is a basic question in Ruby:
Is there a way to check if
a == b
even if a is an integer and b is a string? I realize that I can do
a.to_s == b.to_s
but I'd like to know if there's some other, better way.
Edit: The question originally had a typo and said a.to_s and b.to_s which was edited after parsenome pointed out...
I'm working with WIN32 COM Object from Ruby via win32ole library
require "win32ole"
#~loading com object
o = WIN32OLE.new('{1A80830AF-4CA5-11D4-BC26-991045698E9C}')
#~invoking "Process" method
o.Process(parameter_1,parameter_2)
"Process" method has two parameters: parameter_1 is input xml string and parameter_2 is output xml string ...
I have a couple questions about Ruby's methods, procedures, and blocks that strike me as rather odd. They're not so much about syntax or function as the logic behind the decisions made.
Question 1:
Why is it that blocks can be passed to methods (e.g. each) but they cannot be assigned to a variable?
I know you can pass them around in ...
Hi, I have to insert a string after a certain character using Ruby.
For example, if I have a line like the following:
(N D CGYRWIFGD2S7 0 1 N)(N D CGYCGYOVFBK0 0 N N)(ISA N N N CGYCG3FEXOIS N PUB NONE N N 0)(ISA N N N CGYCGYFGAOIS N PUB NONE N N 0)(ISA N N N CGYCG2FGAOIS N PUB NONE N N 0)(N D CGYCGYOVFBK1 0 N N)(N D CGYLOCFGA2S7 0 N N...
I wrote a blogging system from scratch (http://seanhess.net). I have the last 10 posts displayed on the index page /, and each post has it's own page /post/a_simple_post. I'm getting a good rank in google when I search for specific info from my posts, but google links to the index page instead of the post page. How do I get the search en...
I am using
# my_app.rb
load 'index.rb'
and start the sever like this
ruby my_app.rb
but it never reload any changes I made in index page.
Did I miss anything here?
thanks
...
In Rails, the closest I've seen to Django Signals are Observers. The problem with them is that they're restricted to triggering callbacks on hardcoded events related to a model's lifecycle.
Django signals can be created anywhere, triggered anywhere and handled anywhere. The model lifecycle callbacks are just regular signals that happen ...
Hi,
I have a list view in my RoR web app. The view is a result of a scaffold operation.
I want to add a button that will refresh the page. I prefer not to use javascript for this one, is there another way?
Creating a button via button_to or form_tag ends up adding a new blank row in the database when it is clicked.
Thanks!
Shay.
...
I'm using spree and created a new payment gateway extension. The problem is, my newly created payment gateway gets created first before the core payment gateway of spree. Here's the error message.
doesn't exist: SHOW FIELDS FROM gateway_options
...
An external web service is sending json or xml towards my app. What would be the best way to consume this data? Is there a built-in library in Rails or Ruby to do this or do I need to use a gem for this?
...
I'm building a simple chat app with Rails. when a user types in a url, I want it to be output as an html link (ie, "url").
I was wondering if there is any library or well known way to do this in Ruby. If not, I've got some decent regex sample code to work with...
...
Hello Ruby/Rails/Merb developers!
Im currently working on a web project that will have a feature to communicate with clients by email. So, let`s say i created account for a customer in my admin panel, then created a topic/thread to discuss questions, tasks and other work-related stuff. So, the customer will receive email notification. A...
The Ruby on Rails website recommends installing Ruby from source under Linux.
I encountered a number of C library problems building ruby from source on a clean install of Unbuntu 9.
All the instructions I found on the net about installing ruby on ubuntu have involved using the prepackaged (.deb-based) ruby. Clearly this isn't what the r...
The ruby extensions in the "ext" directory of my ubuntu ruby interpreter i.e. zlib, etc, io, ... fail to load.
I mean they're recognized as extensions - I don't get a "no such file" error, yet they fail to load (i.e. return false).
Running this:
puts require 'zlib'
prints "false"
Is there a way of tracking down why a module fails...
class A
def a
puts 'in #a'
end
end
class B < A
def a
b()
end
def b
# here i want to call A#a.
end
end
...