jruby

Why is a Regexp object considered to be “falsy” in Ruby?

纵饮孤独 提交于 2019-12-04 10:15:45
问题 Ruby has a universal idea of " truthiness " and " falsiness ". Ruby does have two specific classes for Boolean objects, TrueClass and FalseClass, with singleton instances denoted by the special variables true and false , respectively. However, truthiness and falsiness are not limited to instances of those two classes, the concept is universal and applies to every single object in Ruby. Every object is either truthy or falsy . The rules are very simple. In particular, only two objects are

Can't install therubyracer in JRuby

耗尽温柔 提交于 2019-12-04 09:54:33
I've installed RVM and then Jruby, this the version that i get when i type: jruby -v: jruby 1.6.5.1 (ruby-1.8.7-p330) (2011-12-27 1bf37c2) (Java HotSpot(TM) Client VM 1.7.0_02) [linux-i386-java] The problem is that I can't install therubyracer gem, i get this when i try to install by jruby -S gem install therubyracer: /usr/local/rvm/rubies/jruby-1.6.5.1/bin/jruby extconf.rb WARNING: JRuby does not support native extensions or the `mkmf' library very we$ Check http://kenai.com/projects/jruby/pages/Home for alternatives. Checking for Python...Unable to build libv8: Python not found! *** extconf

Convert bloc to lambda in JRuby

南楼画角 提交于 2019-12-04 09:12:34
How does one convert a bloc to a lambda in jruby? Basically what is the jruby answer for this: Ruby: convert proc to lambda? ? As long as you're running jruby 1.9-compatibly (e.g. jruby --1.9 -S irb ), it should be the same: my_proc = proc { |x| x } my_lambda = lambda &my_proc my_lambda.lambda? # => true 来源: https://stackoverflow.com/questions/13239338/convert-bloc-to-lambda-in-jruby

Installing gems from behind a corporate firewall

梦想与她 提交于 2019-12-04 05:27:28
I suspect that the corporate firewall is preventing gems from getting installed. I have HTTP_PROXY defined and I'm able to view remote gems via the following command: jruby -S gem list -r But when I go to install a gem, I get a 404: jruby -S gem install rails Is there a good workaround for resolving this issue other than maintaining an internal gem repository? for ruby gems, placing this in my gem.bat this works for me @"%~dp0ruby.exe" "%~dpn0" %* --http-proxy http://domainname.ccc.com:8080 for jruby gems this works @"%~dp0jruby.exe" "%~dpn0" %* -p http://domainname.ccc.com:8080 Also setting

How to use nokogiri from Jruby on Windows?

心已入冬 提交于 2019-12-04 05:14:52
问题 I'm getting the following error when trying to use Nokogiri with Jruby on Windows 7 D:\code\h4>jruby -e "require 'rubygems'; require 'nokogiri'" D:/jruby-1.3.1/bin/../lib/ruby/1.8/ffi/library.rb:18:in `ffi_lib': Could not ope n any of [xml2, xslt, exslt] (LoadError) from D:/jruby-1.3.1/lib/ruby/gems/1.8/gems/nokogiri-1.3.3-java/lib/nokog iri/ffi/libxml.rb:5 from D:/jruby-1.3.1/lib/ruby/gems/1.8/gems/nokogiri-1.3.3-java/lib/nokog iri/ffi/libxml.rb:31:in `require' from D:/jruby-1.3.1/bin/../lib

Using class instance variable for mutex in Ruby

十年热恋 提交于 2019-12-04 03:48:16
问题 Note: The code summary shown below is not a distillation of the code that I had the problem with. I've left this original summary here since someone else already answered, but the actual code is shown in the answer I've provided below. I haven't been able to isolate this to a small failing test case, but I'm getting a failure with the following general construct: class Foo @mutex = Mutex.new .... def self.bar @mutex.synchronize { ... } end end If I create multiple threads invoking Foo.bar ,

Rails console issues using JRuby: no prompt character, no tab completion, broken arrow keys, etc

a 夏天 提交于 2019-12-04 02:31:00
I'm having various issues with my Rails console under JRuby, including No prompt character Tab completion not working (literal tab gets inserted) Up/down arrows not browsing history ( ^[[A or ^[[B gets inserted, respectively) Left/right arrows not moving cursor ( ^[[D or ^[[C gets inserted, respectively) Home / End keys not moving cursor to beginning/end of line (instead 1~ or 4~ inserted, respectively); Ctrl + a / Ctrl + e work though Ctrl + c killing console instead of killing the line I'm entering Ctrl + d not having any effect until I hit Enter (which then executes anything I entered

Why does logstash take so long to start/load?

社会主义新天地 提交于 2019-12-04 02:27:17
Edit : I changed the title because the issue was not what I initially thought. The fact is that logstash takes more than a minute to starts, which can be misinterpreted as "silence"... I'm trying to make logstash running, so I've followed the instruction on the official site for a standalone installation : http://logstash.net/docs/1.1.4/tutorials/getting-started-simple Basically, I got the logstash-1.1.4-monolithic.jar file, then build a very simple config file : ( example.conf ) input { stdin { type => "stdin-type" } } output { stdout { debug_format => "json" } } But when I run logstash,

JRruby, Sybase JDBC and DBI - fetching column name with the AS clause issue

久未见 提交于 2019-12-03 21:53:18
I have a ruby script which I run using the JRuby Interpreter. The script connects to a Sybase database using DBI and Sybase JDBC (jTDS3.jar and jconn3.jar) My problem is that I have a select query that alters the column names of table. For example: SELECT t.TRANSACTION as 'business_transaction', t.TRADE_CURRENCY as 'currency', t.CURRENCY as 'settlement_currency' ...etc... FROM TRADE t ...etc... My problem is when using the examples directly from the documentation sth = dbh.execute(stmt) printf "Number of rows: %d\n", rows.size printf "Number of columns: %d\n", sth.column_names.size sth.column

Using Sybase ASE 12.5.4 with jTDS drivers with JRuby

£可爱£侵袭症+ 提交于 2019-12-03 20:19:58
Problem I am trying to build a small ruby script - which will be run using jruby once a day - to connect to a Sybase ASE 12.5.4 database and perform a complex query. Ultimately I intend to do some processing on the data and insert the new data in a MySQL table for use within a rails application. Environment jruby v1.4.0 java v1.6.0_15 on Ubuntu Karmic JRuby Installed Gems activerecord-jdbc-adapter (0.9.1) activerecord-2.3.4 Jruby Lib Directory jtds-1.2.5 Query SET rowcount 10 SELECT * FROM TEST_TABLE Code Snippet require 'java' require 'jtds-1.2.5.jar' require 'rubygems' require 'active_record