how to check if some object is included in some module? I know that there are methods #kind_of?/#is_a? to check if one object is a same type or a subclass of another object. But what if i want to check if one object is in some module? For example: module MyModule class MyClass end end m = MyModule::MyClass.new m.kind_of?(MyModule) # => false I would be ha... 2 Aug 2010 13:38
Standard IO streams in Ruby In my rails controller, I am doing the following : @output = `g++ j.cpp -o "prog" && ./prog` This gives the output in the @output variable which i can display in my view. But the above works only if the j.cpp is correct and doesn't expect any user input. How can I use the stdin/stderr and stdout streams here s... 3 Aug 2010 22:25
REXML - controlling whitespaces and inserting CR Hello All, I have an XML file containing this <properties> <property key="ABC"> <value xml:lang="de">Description de</value> <value xml:lang="en">Description en</value> </property> <property key="XYZ"> <value xml:lang="de">Description de</value> <value xml:lang="en"... 12 Aug 2010 19:10
Could I build a video chat site with ruby on rails? Take ustreamtv.com, for instance, would I be able to make a website like that with ruby on rails? Or what programming language does that? -- Posted via http://www.ruby-forum.com/. ... 1 Aug 2010 13:44
what is the correct way to extend native methods? Hello! suppose I want to modify Array.slice() (and consequentially, Array[]) in order to accept a RegExp as argument, and return values matching the regular expression. I tried to solve this problem in this way: class Array def slice_with_regexp(*args) puts args return self.select{ |val| val.to... 1 Aug 2010 17:00
FREE SOFTWARE FREE SOFTWARE Download free software like games[http://sites.google.com/site/ freesoftwarealert] , web browsers, screen savers [http:// sites.google.com/site/freesoftwarealert] , libraries, drivers, desktop themes, and spyware blockers. *********************************** [http://sites.google.com/site/freesoftw... 31 Jul 2010 19:27
each method Hi What can I do to can apply some change to an array for always ? ( I want to use iterator and each method and apply some change in an array ) -- Posted via http://www.ruby-forum.com/. ... 1 Aug 2010 08:19
Argument Error Hi. I'm learning Ruby and I want to know how to make a script have an argument, i.e. ruby script.rb 3 2 So far I have this: abort "Correct syntax is ruby [script].rb [number to exponentially multiply by] [exponent]" unless ARGV.size == 2 var = gets.chomp var2 = gets.chomp puts (var.to_i ** var2) It... 1 Aug 2010 02:59
Mocking a method with a block Hi people, I have an application that download emails from an email account an process them. What I would like to do is to mock the mail download petition and not process the real mails but an array of mails I have for this propos. This is the precise situation: I have this: [code] Net::POP3.start(... 2 Aug 2010 14:44
Active Record Inheritance with out using type_id Hi, I am writing a script that queries a database for records with either the value '333' or '444' in a field called pin_id in a table called pop. Currently I have created a model called GoodPop using set_table_name :pop I have overrided the first, last and all methods to return only those records with a pin_id... 1 Aug 2010 11:34 |