Description:
The Ruby dynamic OO programming language.
|
|
|
deaf grandma.
|
| |
i picked up ruby 2 days ago & have been bustlin' chris pine's "learn to program" tutorial, which goes over various aspects of ruby on a very fundamental level. up until today, i've had relatively no problem working out the exercises. but, as i expected, i've run into my first significant obstacle. the exercise is as follows, "write a deaf grandma... more »
|
|
Is there a better way to do this wxPython example in Ruby?
|
| |
I have been translating examples from the book "wxPython in Action" into Ruby using wxRuby2. I ran into one example where a method was passed as a parameter in Python. I came up with the solution shown below in Ruby (which works fine) but it seems ugly to me. If someone was not very familiar with Ruby they would say "hmmm... what's this... more »
|
|
Faster Marshaling?
|
| |
Exploring options... wondering if there's anything that can replace marshaling that's similar in usage (dump & load to/from disk file), but faster than the native implementation in Ruby 1.8.6 I can explain some details if necessary, but in short: - I need to marshal, - I need to swap data sets often enough that performance... more »
|
|
sort Array of Hashes
|
| |
Hi all, i wrote array of hashes and i would like to sort it. I search in the net few hours how to do this, but was not able to find exactly what i wanted. Here is my code: _FilesData = Array.new _FilesData << { :FileName => splitLine[8] , :Year => Time.now.year , :Month => month ,... more »
|
|
Invoke block in current binding?
|
| |
I have a design pattern (Rails app, using RestfulAuthentication plugin with modifications) that wants to have a method that will temporarily elevate user privileges like so: def sudo saved_current_user = current_user current_user = admin_user yield current_user = saved_current_user end And in a method, invoke it with... more »
|
|
Convert month string to number
|
| |
Hi all, I use linux OS. I would like to convert a file with the folloing format: -rw-r--r-- 1 student student 11289 26. Jul 22:41 listing.txt into FileName, Year, Month, Day In order to do this, i would like to convert the month string from "Jul" in to the number 7. I wrote the following code: def ConvertMonthToNumber(MonthStr)... more »
|
|
DSL/thread design question
|
| |
I am writing something which I am calling "suits" for now -- the idea being "something you make with threads". It's a lightweight actor model. Works something like this: s = Suit.new([]) s.push(1,2,3,4,5) # asynchronous, so ignoring the return value s[2].now # returns 3... more »
|
|
Marshal version problem
|
| |
I have a script that generates a serialized file of native data structures (hash of hashes & arrays and such). In a short spike script I wanted to load up a particular file, and got a version error: incompatible marshal file format (can't be read) (TypeError) format version 4.8 required; 47.85 given... more »
|
|
head/tail split for path
|
| |
I need to split a path by head/*tail. Ex. File.head_tail_split('home/foo /bar') #=> [ 'home', 'foo/bar' ] Sure, I can write a clumsy loop like the following: def File.head_tail_split(fname) s = fname t = [] h = nil until s == '.' t << h s, h = *split(s) end return h, File.join(*t.compact)... more »
|
|
|