If I have the following project structure
project/
lib/
subproject/
a.rb
b.rb
lib.rb
where lib.rb looks like this :-
module Subproject
def foo
do_some_stuff
end
end
and a.rb and b.rb both need to mixin some methods within lib.rb and are both namespaced within a module like so :-
require 'subpro...
I'm running Snow Leopard, and installed a custom built Ruby according to the guide here: http://hivelogic.com/articles/compiling-ruby-rubygems-and-rails-on-snow-leopard . My ruby binary lives in usr/local/bin/ruby and my gems are installed in /usr/local/bin/gem . My gem env looks like so:
RUBY VERSION: 1.8.7 (2008-08-11 patchlevel ...
Which set of libraries and tools would you recommend to use for development SOAP-service on Ruby 1.9 - soap-tools, web-servers, or maybe a web-framework?
...
This is more of an algorithmic dilemma than a language-specific problem, but since I'm currently using Ruby I'll tag this as such. I've already spent over 20 hours on this and I would've never believed it if someone told me writing a LaTeX parser was a walk in the park in comparison.
I have a loop to read hierarchies (that are prefixed ...
Hello!
I try to access a form using mechanize (Ruby).
On my form I have a gorup of Radiobuttons.
So I want to check one of them.
I wrote:
target_form.radiobutton_with(:name => "radiobuttonname")[2].check
In this line I want to check the radiobutton with the value of 2.
But in this line, I get an error:
: undefined method `radiobutto...
I want to use gcd function of the Integer class. Using the example from Ruby Doc as a test it fails:
irb(main):001:0> 72.gcd 168
NoMethodError: undefined method `gcd' for 72:Fixnum
from (irb):1
I have the windows one click installer ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-mswin32]. On other PCs with the same version of ru...
I'm having some problems trying to get the code below to output the data in the format that I want. What I'm after is the following:
CCC1-$5.00
CCC1-$10.00
CCC1-$15.00
CCC2-$7.00
where $7 belongs to CCC2 and the others to CCC1, but I can only manage to get the data in this format:
CCC1-$5.00
CCC1-$10.00
CCC1-$15.00
...
Hi,
I have a Ruby program that zips a directory tree of XML files using the rubyzip gem. My problem is that the file is starting to be heavy and I would like to increase the compression level, since compression time is not an issue.
I could not find in the rubyzip documentation a way to specify the compression level for the created ZIP...
I'm Getting this error in my development log while uploadify is uploading the file and in the view i get an 'IO ERROR' beside filename.
/!\ FAILSAFE /!\ Thu Mar 18 11:54:53 -0500 2010
Status: 500 Internal Server Error
bad content body
/usr/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/utils.rb:351:in `parse_multipart'
/usr/li...
What is the best way to make my Qt Ruby application into an executable and distribute on windows? I have seen rubyscript2exe but it looks abandoned.
...
Hi, I want to display the column 'name' after being found from the table mytest.
In the mytest.rb, I defined "attrib_accessor :name";
In the procedure index under directory /controller/mytest_controller.rb,
def index
###[Ignore some code]
@[email protected]_by_id
### I am able to verify the tuples in @mytesttbl
end
In the /vie...
I must really be missing something obvious, but I'm having trouble with general use of Log4r in my Ruby application. I am able to log without issue, but the overhead seems clunky the way I have it setup. I'm basically passing the full path to a filename to log in each class in my application. The ruby script that is called pulls the l...
Hi, I'm looking for a function grapher that I can use in a small Rails application I'm working on for my university. Is there anything out there? If it needs the values (points) is not a problem but it would be better if it just parsed the equation. The functions will be 100% in ruby format (for example Math.exp(3*x))...
Thanks a lot!
...
I was trying to write a validation for Rails to ensure that a price entered on a form was greater than zero. It works…sort of. The problem is that when I run it, val is turned into an integer, so it thinks that .99 is less than .1. What's going on, and how should I fix the code?
class Product < ActiveRecord::Base
protected
def sel...
What's the effect in Ruby when you pass nil to the constructor as in:
s = String(nil)
or
a = Array(nil)
Does this mean that s or a is nil or that s or a is an unpopulated object of type String or type Array?
...
any idea how i can get the code below to produce this output?
1 -
2 - B
i'm getting this error "undefined method `text' for nil:NilClass (NoMethodError)", because i think table 1 does not have the element 'td class=r2' in it.
require 'rubygems'
require 'nokogiri'
require 'open-uri'
doc = Nokogiri::HTML.parse(<<-eohtml)
<table cla...
Hi, as object i'm tring to create a client and server scripts in order to send and receive multicast packages over IPv6. In IPv4 everything work as well, but i cannot figure out how to change it in IPv6.
I start as basis from Multicasting In Ruby but seems ff12::3422 isnt good for MULTICAST_ADDR as others i already try to assign.
Than...
Just finished reading this blog post: http://www.skorks.com/2010/03/an-interview-question-that-prints-out-its-own-source-code-in-ruby/
In it, the author argues the case for using a quine as an interview question. I'm not sure I agree but thats not what this question is about.
He goes on to construct a quine in Ruby and refactor it to ...
Hi All,
I want regular expression in ruby on rails which remove all the html tags and its content from the given text.
For example if my text is :-INPUT :-
<span id="span_is"><br><br><u><i>Hi</i></u></span>
then it should display only OUTPUT should be as follows:-
Hi
in short i want regular expression or a function which remove...
I have an application written in ruby (that runs in the JRuby VM). When profiling it, I realized that it spends a lot (actually almost all of) its time converting some hashes into JSON.
These hashes have keys of symbols, values of other similar hashes, arrays, strings, and numbers.
Is there a serialization method that is suitable for s...