Emacs / rcodetools322 (10/19/2008 9:12:55 PM) comp.lang.ruby Hi all, I'm trying to get emacs running nicely all weekend. But I can't get certain things to work. I've installed rcodetools and tried to use it for tab-completion. Using m-X rct-complete-symbol works just f... Leon
Quickie: Monkey patching Array833 (5/29/2008 9:51:05 PM) comp.lang.ruby Hi all, A quick question: is it possible to monkey patch the Array [] method in ruby? I tried: class Array def []=(elem) raise 'Yesss... It works!' end end But that didn't work. I tried patching ... Leon
inclusion of module: differences216 (5/28/2008 10:27:35 PM) comp.lang.ruby Hi all! I have this code: http://pastie.caboo.se/205063 And the output of that script is: "Included from Array3" "Included from Array" "Included from Array2" "[]" "[]" "aaarghhhh..." nil Obiou... Leon
Calling instance method when module included025 (5/28/2008 9:01:30 PM) comp.lang.ruby Hi all, Maybe a silly question, but is it possible to call instance methods on an object when you've included a module? Or maybe I'm having the wrong approach and somebody can point me in the right direction? ... Leon
Easy way to use "self" in Proc516 (5/16/2008 10:59:40 PM) comp.lang.ruby Hi all, I have this piece of code: http://pastie.caboo.se/198524 I'm trying to use the "self" context of the instanciated class in the Proc. I've got it working now, but isn't there a nicer way to use the Proc... Leon
Sharing variables between classes and instances630 (5/11/2008 12:19:46 AM) comp.lang.ruby Hi all, What I'm trying to achieve: add a variable to a class. Fill it with data. Every nstance of that class should have access to the data in that variable. But I want every instance be able to modify that v... Leon
including instance methods and setting an instance variable1914 (3/20/2008 10:55:09 PM) comp.lang.ruby Hi all, I'm trying to include a module and in that module I want to set an instance variable. I have the following: class Queue include LBo::InstanceMethods end module LBo module InstanceMethods attr... Leon
alias_method and initialize1037 (2/8/2008 10:01:29 PM) comp.lang.ruby Hi all! I've got a question about using alias_method with a class and a module. The module gets included by the class. But I can't figure out how to deal with the initialize method. This is my script with out... Leon
Add files to array matching pattern736 (10/4/2007 11:08:56 PM) comp.lang.ruby Hi all, I wanted to simply add files to an array. The files must match a pattern. I'm just starting with ruby so I really have to find my way in it. I tried something like: dir = "/home/leon/images" test = Ar... Leon
rtrim and ltrim function for ruby: is this ok? #2648 (7/25/2007 7:26:47 PM) comp.lang.ruby I made these two functions to extend the default String object: class String def rtrim(character) if self[-1, 1] == character.to_s self[0, self.length - 1] end return self end def ltrim(character... LeonB
leon160's replies:
Items(10) /1
rtrim and ltrim function for ruby: is this ok?541 (7/24/2007 10:50:26 PM) comp.lang.ruby I created this function: class String def rtrim(character) if self[-1, 1] == character.to_s self[0, self.length - 1] end return self end def ltrim(character) if self[0, 1] == character.to_s ... leon160(34)
rtrim and ltrim function for ruby: is this ok? #2648 (7/25/2007 7:26:47 PM) comp.lang.ruby I made these two functions to extend the default String object: class String def rtrim(character) if self[-1, 1] == character.to_s self[0, self.length - 1] end return self end def ltrim(character... leon160(34)
Add files to array matching pattern736 (10/4/2007 11:08:56 PM) comp.lang.ruby Hi all, I wanted to simply add files to an array. The files must match a pattern. I'm just starting with ruby so I really have to find my way in it. I tried something like: dir = "/home/leon/images" test = Ar... leon160(34)
alias_method and initialize1037 (2/8/2008 10:01:29 PM) comp.lang.ruby Hi all! I've got a question about using alias_method with a class and a module. The module gets included by the class. But I can't figure out how to deal with the initialize method. This is my script with out... leon160(34)
Sharing variables between classes and instances630 (5/11/2008 12:19:46 AM) comp.lang.ruby Hi all, What I'm trying to achieve: add a variable to a class. Fill it with data. Every nstance of that class should have access to the data in that variable. But I want every instance be able to modify that v... leon160(34)
Easy way to use "self" in Proc516 (5/16/2008 10:59:40 PM) comp.lang.ruby Hi all, I have this piece of code: http://pastie.caboo.se/198524 I'm trying to use the "self" context of the instanciated class in the Proc. I've got it working now, but isn't there a nicer way to use the Proc... leon160(34)
inclusion of module: differences216 (5/28/2008 10:27:35 PM) comp.lang.ruby Hi all! I have this code: http://pastie.caboo.se/205063 And the output of that script is: "Included from Array3" "Included from Array" "Included from Array2" "[]" "[]" "aaarghhhh..." nil Obiou... leon160(34)
Quickie: Monkey patching Array833 (5/29/2008 9:51:05 PM) comp.lang.ruby Hi all, A quick question: is it possible to monkey patch the Array [] method in ruby? I tried: class Array def []=(elem) raise 'Yesss... It works!' end end But that didn't work. I tried patching ... leon160(34)
Emacs / rcodetools322 (10/19/2008 9:12:55 PM) comp.lang.ruby Hi all, I'm trying to get emacs running nicely all weekend. But I can't get certain things to work. I've installed rcodetools and tried to use it for tab-completion. Using m-X rct-complete-symbol works just f... leon160(34)