If using HAML on Ruby on Rails, then
:sass
#someDiv
border: 3px dashed orange
won't have any <style> tag around them.
and then
:css
:sass
#someDiv
border: 3px dashed orange
won't kick on the :sass filter, but
:css
:sass
#someDiv
border: 3px dashed orange
will kick on the :sass filter, but it is outside of the <style> tag. So how can the :sass filter be used?
How do I add information to an exception message without changing its class in ruby?
The approach I'm currently using is
strings.each_with_index do |string, i|
begin
do_risky_operation(string)
rescue
raise $!.class, "Problem with string number #{i}: #{$!}"
end
end
Is there a better way?
I'm looking for an easy way to get width and height dimensions for image files in Ruby without having to use ImageMagick or ImageScience (running Snow Leapard).
there is a jsp web:
http://xbrl.cninfo.com.cn/XBRL/allinfo.jsp?stkid=000002&getyear=2005&nowpage=Info.jsp&reportType=GB0110
can i scrap data from it with Nokogiri or other ruby tools?
I'm hoping that Ruby's message-passing infrastructure means there's some clever trick for this...
How do I determine the calling object -- which object called the method I'm currently in?
I can, on some of my systems, get my IP address (192.68.m.n format) by doing this:
addr = IPSocket::getAddress(Socket.gethostname())
...the trouble is that this only works if the name the local machine uses for itself is the name the DNS server associates with it.
How *&#( hard can it be for ruby to just return its primary interface's IP address? I have to do this in a platform-independant way or I'd just call ifconfig or ipconfig and parse it.
Is it possible to check the gem version of the currently loaded gem in a ruby/rails app?
During debugging, I would like to be able to do something like:
puts RubyGem.loaded_version(:active_support)
Anything like that exist?
I would like to pull the titleand description fields from the newsfeed at http://www.tagesschau.de/newsticker.rdf to feed them to the Mac's Text-to-Speech engine.
My search for a nice Ruby Gem to do this has brought me to Nokogiri, but all examples that "pull something out" of a given XML seem to be centered around CSS somehow.
Does anyone have any idea how to save the titleand description fields in an array?
Which is better source control with NetBeans (Ruby on Rails), VSS or subversion?
I want to use source control, so I want to know which is better for NetBeans (RoR). Visual Source safe or Subversion?
My question is similar to this one over here about include and extend.
What's the difference between require and include in Ruby? If I just want to use the methods from a module in my class, should I require it or include it?
I realize this sounds a little crazy, but I'm working on a project for which I need a server to run user-provided Ruby code and return the result.
I'm looking to prevent something like this:
system("rm -rf /")
eval("something_evil")
# etc...
I'm sure there must be some reasonably safe way to do this, as it already exists at places like tryruby.org. Any help is greatly appreciated, thanks!
In Ruby on Rails,
http://localhost:3000/foobars/alt/1
works
but
http://localhost:3000/foobars/alt/1.xml
doesn't work.
config/route.rb is
map.connect ':controller/:action/:id'
map.connect ':controller/:action/:id.:format'
so supposedly it supports an id.format in the URL?
I want to run my ruby script x times a day (the number might change) on my linux box. What would be the best way to do so if I do not want it to happen at the same time? I want the time (hour and minute) to be random
If I have the following piece of Ruby code:
class Blah
def self.bleh
@blih = "Hello"
@@bloh = "World"
end
end
What exactly are @blih and @@bloh? @blih is an instance variable in the class Blah, and @@bloh is a class variable in the class Blah, correct? Does it mean that @@bloh is a variable in Blah's class, Class?
Hi All,
I've spent some time today looking for a pure ruby library that will parse an excel workbook. I could find the parseexcel gem in the repos, but the problem is that I can't find any documentation on it. and the rdoc is pitiful. so, my question is 1) is there good documentation out there for this gem? 2) if not, is there another gem that does the same thing that has good documentation?
thx :)
-C
I have two Ruby arrays, and I need to see if they have any values in common. I could just loop through each of the values in one array and do include?() on the other, but I'm sure there's a better way. What is it? (The arrays both hold strings.)
Thanks.
given an xml string like this:
<some><nested><xml>value</xml></nested></some>
what's the best option (using ruby) to format it into something readable like:
<some>
<nested>
<xml>value</xml>
</nested>
</some>
It is said that FastCGI doesn't work well with Ruby on Rails deployment. Why is that? In previous experience, something either works quite well or it might be fundamentally wrong. So if FastCGI is a viable solution, why is it not reliable with RoR?
Does FastCGI work well with most any language / frameworks?
Hi,
I'm looking at some external code and saw a line of Ruby code that looks like this
string_name = string_name[3..-1]
what does the [n..-x] do or mean?
Thanks.