大江戸Ruby会議04の講演"Hacking Home"のスライド http://regional.rubykaigi.org/oedo04 #oedo04
Please do not edit this page. File a new ticket instead. Refinements Specification¶ Abstract¶ This documentation describes the specification of Refinements, which provide local class extensions. Rationale¶ Monkey patching is a powerful feature of Ruby.However, it affects globally in a program. Therefore, a monkey patch might break code which doesn't expect the extended behavior, and multiple monke
Ruby Gnuplot – How To ChangeLog Authors License History and Background Gnuplot is a program that has a rich language for the generation of plots. It has a unique place in academia as it was one of the first freely available programs for plot generation. I started using gnuplot over 10 years ago while pursuing my Master’s degree in Physics and have been using it actively ever since. Now rdp maintai
_ Rubyで遅延評価 - delay, force, lazy 正格評価の言語で明示的に遅延評価を行う方法として、Schemeのdelay/forceがある。 Rubyで実装するとこんな感じ。 class Promise NULL = Object.new def initialize(&block) @value = NULL @block = block end def self.delay(&block) new(&block) end def force if @value == NULL @value = @block.call else @value end end end count = 0 x = Promise.delay { count += 1; 1 + 2 } p x.force #=> 3 p x.force #=> 3 p count #=> 1 メモ化してく
_ flat_map、非決定性計算、リスト内包表記 Ruby 1.9では、Enumerable#flat_mapというメソッドが追加されている。 %w(ruby perl python).flat_map {|i| i.chars.to_a} #=> ["r", "u", "b", "y", "p", "e", "r", "l", "p", "y", "t", "h", "o", "n"] といった動作をするもので、要はブロックが返す配列を連結した配列を返す。 %w(ruby perl python).map {|i| i.chars.to_a}.flatten(1) とすれば同じことができるのにどうしてわざわざ追加したのか疑問に思われるかもしれないが、 実はflat_mapが追加されたということは、Rubyの配列がHaskellのリストモナドのように使えることを意味している。 以前の日記
Issue #1685 has been updated by B Kelly. File spatulasnout-unicode-mkdir-diffs.txt added File test_io_unicode_paths.rb added Hi, I'll be needing win32 unicode path support for my current project, so I would like to try to tackle the remaining issues. I started with a relatively easy one, Dir.mkdir For Dir.mkdir, I took an approach similar to what was already in place for rb_sysopen(), which is tha
昨年 3 月に JIS 規格として制定された Ruby だが (/.J 記事)、2012 年 3 月 31 日に締め切られた国際規格承認のための最終投票の結果、国際規格 ISO/IEC 30170 として承認された (IPA のプレス発表記事より) 。 Ruby が国際規格となったことで、Ruby 言語仕様の安定性や信頼性が増し、Ruby を学ぶプログラマーの数、Ruby を採用する企業や組織の数が増大することが期待される、との IPA の言。 Ruby が国際規格として承認されたことを記念して、まつもとゆきひろ氏、中田育男氏他による講演会を 2012 年 6 月 5 日午後に実施する予定、とのことだ。
Jay Fields' Thoughts: Alternatives for redefining methods メソッドの再定義の技法はいろいろあるが、どれも欠点があるというお話。状況に応じて使い分けるべき。 aliasで再定義 メソッドを再定義するときにこんな感じでaliasで元のメソッドをコピーするのは常套手段だ。 class Gateway def process(document) p "gateway processed document: #{document}" end end class Gateway alias old_process process def process(document) p "do something else" old_process(document) end end Gateway.new.process("hello world")
前回、前々回の記事では、Rackの生まれた背景、Rackとは何か、実際にRackアプリケーションを作る際に使えるものをご紹介しましたが、もう一つまだ説明していない重要な要素がRackにはあります。今回は、そのミドルウェアという仕組みについてご紹介します。 ミドルウェアとは ミドルウェアとは何かを一言で言うと、「別なアプリケーションをラップして、リクエストやレスポンスを加工したり、処理を切り換えたりするRackアプリケーション」です。 この仕組みがあることで一体何ができるのでしょうか。Webアプリケーションを作っていると、リクエストやレスポンスをアプリケーションに行く前やアプリケーションの処理の後に加工したくなることはよくあります。例えば、条件に応じてURLの書き換えをしたり、エンコーディングの変換をしたり、Cookieの処理をしたり…といったことが日常茶飯事です。こういう処理を、サーバと
Gitdocs Open-source dropbox alternative powered by git. Collaborate on files and tasks without any extra hassle. gitdocs will automatically keep everyone's repos in sync by pushing and pulling changes. This allows any git repo to be used as a collaborative task list, file share, or wiki for a team. Supports a web front-end allowing each repo to be accessed through your browser. Note: Gitdocs has b
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く