Hello :)
I have a rake task (in lib/tasks directory) that I run with cron on my shared web hosting. The problem is that I want to compare a UTF-8 string using case statment but my source code is not UTF-8 encoded. If I save source code as UTF-8 there is error when I try to start it :(
What I have to do?
May be read this strings from ...
In answering this code golf question, I ran across a problem in my answer.
I've been testing this and I cannot even get these two comparisons to work in the code, despite the fact that IRB has the right behavior. I really need some help here.
Here's the code, below that will be an explanation of the problem.
def solve_expression(expr...
Hi All,
Does anyone have any quality (and up-to-date) information regarding sending mail via Gmail using Ruby's Net::SMTP? I've seen several examples -- most dating from 2007 to mid-2008 and none of them work for me. I need more current examples that use the most recent 1.8.7 release. I'd also appreciate if the documentation didn't o...
I noticed that class variables @@my_class var are now looked up in the context of the instance_eval'd object in Ruby 1.9.1 whereas this was not the case in Ruby 1.8.6.
What are some other differences in behaviour of instance_eval for Ruby 1.9.1 ?
...
I am using Ruby 1.8.6 for the following code:
# Create an array and override the #to_s on that object
thing = [1,2,3]
def thing.to_s
'one'
end
print "Using print: "
print thing
puts
puts "Using puts: "
puts thing
Output:
Using print: one
Using puts:
1
2
3
So thing is an Array and I have overridden thing#to_s. print seems to us...
If I add this to the beginning of my script:
$KCODE = 'UTF8'
require 'jcode'
then I can walk over every char of a word containing unicode characters. Imagine a word containing umlauts or something, and I iterate over them like this:
word.each_char do |c|
# do something with c
end
If c is a unicode character and I print it's size,...
I have two applications talking to each other using a queue, as of now they run exactly the same version of ruby (1.8.7), so I'm just marshaling objects back and forth; only objects from the standard lib mostly hashes, strings, time and date objects.
Right now I'm moving to Ruby 1.9.1, one app at the time, which means I'll be running o...
So I'm writing a Ruby client for a SOAP web service, and I've figured out how to call a simple method:
# WebServiceClient.rb
require 'soap/wsdlDriver'
wsdl_url = 'http://urlmadness?wsdl'
service = SOAP::WSDLDriverFactory.new(wsdl_url).create_rpc_driver
result = service.simpleMethod(:sayHello => 'Hello')
p result.return
Now I need t...
So far, I've been merely using YARV (ruby 1.9) as merely a faster implementation of ruby than ruby 1.8, and ensured that all of my code is backwards-compatible with ruby 1.8.6. What circumstances, if any, are stopping you from writing 1.9-specific code?
One reason per answer.
...
Currently Google SketchUp for Mac has Ruby version 1.8.5 which I find a bit outdated. I can update Ruby to 1.8.7 (OSX's version) by the following commands
$ cd /Applications/Google\ SketchUp\ 7/SketchUp.app/Contents/Frameworks/Ruby.framework/Versions/Current
$ ls
Headers/ Resources/ Ruby
$ ls Headers/
config.h defines.h inter...
I'm using ruby 1.8.7 and I need to compare two hashes that I have, which are essentially the attributes of a model. Hash A is smaller than Hash B, and Hash B has all of the attributes of hash A, plus some extra attributes I don't care about. My overarching goal is to see if the elements of A are the same as the respective elements of B...