where is instance_eval() defined?428 (5/18/2011 9:10:53 PM) comp.lang.ruby Where in the hell is instance_eval() defined? In "The Ruby Programming Language", it says it's defined in Object, but the 1.9.2 docs don't list it in Object: http://www.ruby-doc.org/core/classes/Object.html ... 7stud
instance_eval trickiness039 (4/15/2011 6:53:15 PM) comp.lang.ruby Hi, I think instance_eval() is the trickiest of the eval's to understand. "Metaprogramming Ruby" says there are two concepts that you have to be aware of: 1) which object is self 2) which object is the curren... 7stud
send() with a block?2224 (3/12/2011 8:45:39 PM) comp.lang.ruby Why don't the ruby docs say that send() can take a block? Kernel.send(:define_method, :my_meth) do |x| puts x end my_meth(10) --output:-- 10 At the following link there is nothing saying that send() will ... 7stud
class_eval() problem226 (3/11/2011 1:42:52 AM) comp.lang.ruby Here is some code that works as expected: def create_class Class.new end MyClass = create_class MyClass.class_eval do def greet puts 'hi' end end obj = MyClass.new obj.greet --output:-- hi Now ... 7stud
parsing rule for this code?1089 (2/25/2011 3:41:08 AM) comp.lang.ruby 1)
class ABC
def do_something
number = 10
puts number
end
end
ABC.new.do_something
--output:--
10
2)
class ABC
def do_something
3.times do |x|
... 7stud
why is $1 in a grep() equal to nil?1577 (2/24/2011 8:59:55 PM) comp.lang.ruby class DataSource
def get_cpu_info
"cpu8001"
end
def get_cpu_price
101
end
def get_mouse_info
"mouse241"
end
def get_mouse_price
40
e... 7stud
installing lxml ?1417 (11/11/2009 12:49:48 PM) comp.lang.python I'm trying to install lxml, but I can't figure out the installation instructions. Here: http://codespeak.net/lxml/installation.html it says: 1) Get the easy_install tool. Ok, I went to the easy_install web... 7stud
start_with? Does someone need a grammar lesson?1427 (8/17/2009 3:49:19 AM) comp.lang.ruby String#start_with?------------------------------- str.start_with?([prefix]+) => true or false From Ruby 1.9.1 ------------------------------------------------ Returns true if _str_ starts wit... 7stud
Ruby Clasess425 (5/21/2011 7:23:16 AM) comp.lang.ruby How do I get all the classes that descend from a parent class ? I found solution on http://stackoverflow.com/questions/2393697/look-up-all-descendants-of-a-class-in-ruby. But I want to know, is there a standar... unc88(5)
Array.index with utf-8451 (5/21/2011 7:44:54 PM) comp.lang.ruby Hi. I have a problem. Windows7 I have an array with russian symbols. Then I want to find something element in it by Array.index(elem). In NetBeans 6.9.1 (it settings with utf-8) it works(write index in FixNu... b1368810(5)
String Element Reference443 (5/25/2011 5:23:38 PM) comp.lang.ruby I am new to Ruby so I apologize if this seems dumb. I am currently running ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]. When working in an irb session I'm having trouble with String element ... solomon.jas(12)
Method that mutates object2241 (5/25/2011 7:22:46 PM) comp.lang.ruby Say we want to write a String method called clear that takes a given string and modifies that string to be equal to "". Ex. str = "string" we call str.clear and we get back "", not just "" printed to the scr... solomon.jas(12)
Need help bringing select array lines together1127 (5/26/2011 4:26:17 PM) comp.lang.ruby Hi there, I am looking at some old, confusing ruby code that works but is really ugly. I'm hoping someone here can help me find a more ruby way of rewriting it. Rather than post the ugly code, I'll describe wha... tester.paul(45)
Read symbols from external file240 (5/27/2011 12:24:22 PM) comp.lang.ruby =begin Hello, I parse an array of symbols to output some program code. In reality I map ALT, CTRL and SHIFT declarations to VK_KEYS in Java. But the principle is the same. It is not a hash, a :symbol_* can app... mbmulder(2)
What is the meaning of #<Net::HTTPFound:0x29b78f8>325 (5/27/2011 12:36:56 PM) comp.lang.ruby Dear All: I am trying to deal with the http response. I am using following code to do so. require 'net/http' require 'uri' def fetch(uri_str, limit = 10) # You should choose better exceptio... amit.srpce(3)
Hash .each and different action for each key753 (5/27/2011 7:44:20 PM) comp.lang.ruby Hello - I have a hash table of several items. What I would like to do is loop through the hash and do a different action based on each unique key. my_hash_table.each_pair do |k, v| # Call a method if a hash... storm8000(6)
Variable scopes with code blocks.125 (5/27/2011 8:55:16 PM) comp.lang.ruby Hello! Novice here. I'm reading Beginning Ruby and Beginning Rails by Apres and building both applications they walk you through. Additionally, I'm taking courses at lynda dot com and attempting to build a sim... aaronsallright(1)