$ ruby ex1.rb ex1.rb:10:in `f3': undefined local variable or method `foobar' for main:Object (NameError) from ex1.rb:6:in `f2' from ex1.rb:2:in `f1' from ex1.rb:13
#!/usr/bin/env ruby require 'webrick' require 'webrick/httpproxy' require 'uri' handler = Proc.new() {|req,res| if req.host == 'slashdot.jp' and res['content-type'] =~ /text\/html/ res.body.gsub!(/<!-- begin ad code -->.*?<!-- end ad code -->/m, '') end } # プロキシサーバオブジェクトを作る s = WEBric...
test/ attributes definitions files libraries metadata.rb providers README.rdoc recipes resources templates
spec -fs array_spec.rb Array when empty - should be empty - should size 0 Array when initialized with object - should not affect others (FAILED - 1) 1) 'Array when initialized with object should not affect others' FAILED expected: [{:cat=>"Nuko"}, {}, {}], got: [{:cat=>"Nuko"}, {:cat=...
SSSTSSTSSS T SSSSSTTSSTST T SSSSSTTSTTSS T SSSSSTTSTTSS T SSSSSTTSTTTT T SSSSSTSSSSS T SSSSSTSTSTTT T SSSSSTTSTTTT T SSSSSTTTSSTS T SSSSSTTSTTSS T SSSSSTTSSTSS T SSSSSSSSTSTS T SS
$ gem install sinatra $ cat <<EOS > app.rb require 'rubygems' require 'sinatra' get '/' do "Hello, World" end EOS $ ruby app.rb #=> http://localhost:4567/ にアクセス
Release progress Keyword arg Lazy Refinements Dtrace GC require Notes & other features Stable version
include WIN32OLE::VARIANT def ie.navigate_post url,query_string header = "Content-type: application/x-www-form-urlencoded" postdata = query_string.unpack("c*") navi = self.ole_method("Navigate2") ret = self._invoke(navi.dispid, [url, nil, nil, postdata, header], [VT_BYREF|VT_VARIANT, ...
open(path, "r:Shift_JIS") {|f| p [f.external_encoding, f.internal_encoding] } #=> [#<Encoding:Shift_JIS>, nil] open(path, "r:Shift_JIS:EUC-JP") {|f| p [f.external_encoding, f.internal_encoding] } #=> [#<Encoding:Shift_JIS>, #<Encoding:EUC-JP>] open(path, "r", :encoding => "Shift_JIS")...
xxx HTTPResponse 1xx HTTPInformation 100 HTTPContinue 101 HTTPSwitchProtocol 2xx HTTPSuccess 200 HTTPOK 201 HTTPCreated 202 HTTPAccepted 203 HTTPNonAuthoritativeInformation 204 HTTPNoContent 205 HTTPResetContent 206 HTTPPartialContent 3xx HTTPRedirection 300 HTTPMultipleChoice 301 HTT...
# # RubiMaVM # module RubiMaVM class Instruction def initialize code, opts @code = code @opts = opts end attr_reader :code, :opts def inspect "#{code} <#{opts.join ', '}>" end end class Label @@id = 0 def initialize label @label = label @pos = -1 @id = @@id+=1 end attr_accessor :pos d...
begin # BODY rescue Exception => e case e when E_C # RESCUE_C when StandardError # RESCUE else # ELSE end ensure # ENSURE end
Tokens: the words that make up the Ruby language Parsing: how Ruby understands the code you write Compilation: how Ruby translates your code into a new language Tokenization, parsing and compilation in JRuby Tokenization, parsing and compilation in Rubinius
The lazy version of 'map' is very convenient, but there is a issue with the method names. The Enumerable module includes many other methods that can be lazily evaluated, such as 'map', 'select', 'reject' and 'drop', but we did not want to inflate Enumerable module with methods such as...
arton 氏の ActiveScriptRuby では、1.8.7-p173 以降のバージョンに DXRuby1.0.4 が同梱されていますので、こちらを利用してる方は DXRuby の個別インストールは不要です。 それ以外の i386-mswin32 版をご利用の方は、SourceForge.jp の DXRuby のダウンロードページ からダウンロードして、インストールしてください。 また、DXRuby どころか Ruby もインストールしてない方や、Windows でも cygwin 環境でお使いの方は、i386-mswin32 版 Ruby インタプリタ...
class Outlook include Singleton def initialize @ol = WIN32OLE::connect("Outlook.Application") end def each_mail_filtered folder,subject events = WIN32OLE_EVENT.new(@ol,"ApplicationEvents_11") search_done = false events.on_event("AdvancedSearchComplete") do |search| results = search.Re...
spec -fs array_spec.rb Array when empty - should be empty - should size 0 Array when initialized with object - should not affect others (FAILED - 1) 1) 'Array when initialized with object should not affect others' FAILED expected: [{:cat=>"Nuko"}, {}, {}], got: [{:cat=>"Nuko"}, {:cat=...
Magic Comment を書いていないファイルの文字列リテラルのエンコーディング (default script encoding) が UTF-8 に変更されました。[#6679] Ruby 1.9 においては、default script encoding は US-ASCII でした。しかし、以下のようなメリット・デメリットを考えた結果、上記の通り UTF-8 へと変更することになりました。 21世紀の現代においてはほとんどのコードが UTF-8 であるため、デフォルトが UTF-8 であった方が便利 1.9 向けの Magic Comment の書かれ...
Parrot Maniacs 〜On the Architecture of the Parrot virtual machine〜
rurema - Revision 5735: /doctree/trunk
Ruby GUI ライブラリ ::FXRuby http://www.gesource.jp/ruby/gui/fxruby.html 逆引き FXRuby http://takahr.dhis.portside.net/cgi-bin/rwiki.cgi?cmd=view;name=%B5%D5%B0%FA%A4%ADFXRuby FOX-Toolkit 日本語ドキュメント http://www.asahi-net.or.jp/~cv8t-hdk/fox/fox-doc.ja/fox.ja.html FOX unicode 化 http://takahr.dhi...
version.h (RUBY_RELEASE_DATE): finally declare start of 2.0 work!
require 'logger' log = Logger.new(STDOUT) log.level = Logger::WARN log.debug("Created logger") log.info("Program started") log.warn("Nothing to do!") begin File.each_line(path) do |line| unless line =~ /^(\w+) = (.*)$/ log.error("Line in wrong format: #{line}") end end rescue => err l...
[Thu, 19 Jan 2012 22:24:46 +0900] INFO: Processing template[/tmp/test.conf] action create (test::default line 24) [Thu, 19 Jan 2012 22:24:46 +0900] DEBUG: Current content's checksum: 15b601f97b98f27fc0e209408fa88366544286d13987c4a6cf87b0734396add8 [Thu, 19 Jan 2012 22:24:46 +0900] DEB...
Rubyist Hotlinks 【第 1 回】 まつもとゆきひろさん Rubyist Hotlinks 【第 2 回】 前田修吾さん Rubyist Hotlinks 【第 3 回】 かずひこさん Rubyist Hotlinks 【第 4 回】 ただただしさん Rubyist Hotlinks 【第 5 回】 増井俊之さん Rubyist Hotlinks 【第 6 回】 江渡浩一郎さん 前編 Rubyist Hotlinks 【第 7 回】 江渡浩一郎さん 後編 Rubyist Hotlinks 【第 8 回】 田中哲さん Rubyist Hotlinks ...
In previous versions of Ruby, the object graph is traversed and marked by using a recursive function call on the machine stack. This may lead to stack overflow when a very deep object graph is traversed. To avoid this, previous versions of Ruby GC stop using the machine stack when a s...
eval"p *%d..%d"%gets.split(',') # 31Bytes for (1) eval"p *%d..%d"%gets.split # 26Bytes for (2) eval"p *%d..%d"%$* # 18Bytes for (3)
[Thu, 19 Jan 2012 22:24:46 +0900] INFO: Processing template[/tmp/test.conf] action create (test::default line 24) [Thu, 19 Jan 2012 22:24:46 +0900] DEBUG: Current content's checksum: 15b601f97b98f27fc0e209408fa88366544286d13987c4a6cf87b0734396add8 [Thu, 19 Jan 2012 22:24:46 +0900] DEB...