タグ

Rubyに関するita-wasaのブックマーク (5)

  • http://www.kt.rim.or.jp/~kbk/zakkicho/08/zakkicho0810c.html

    ita-wasa
    ita-wasa 2008/10/22
    勘違いしないで欲しいのだが、Rubyは great language だ。 わたしはRubyのブロックをさんざん使ってきている。 Rubyでのコードは美しく、一貫性のある、表現性豊か(expressive)なものにできる。 ブロックはわたしにとって gateway
  • Rubyのexpect.rbの使い方

    SSHでつないで何か操作を行ったり、パスワードの入力を自動化したり、対話形式のプログラムをプログラム中から利用する場合は、expectモジュールを使用するのが一般的です。 Rubyは標準ライブラリ中にexpect.rbが存在していますが、IO#exceptとしてIOのメソッドとして定義されていて、このままでは扱いにくいので、仮想端末を扱うPTYライブラリとあわせて使用します。 require 'pty' require 'expect' module Expect def spawn(cmd) puts "CMD: #{cmd}" if $expect_verbose PTY.spawn(cmd) do |r,w,pid| @input_stream = r @output_stream = w @child_pid = pid PTY.protect_signal do yield en

    ita-wasa
    ita-wasa 2008/10/07
    SSHでつないで何か操作を行ったり、パスワードの入力を自動化したり、対話形式のプログラムをプログラム中から利用する場合は、expectモジュールを使用するのが一般的です。 Rubyは標準ライブラリ中にexpect.rbが存在してい
  • Just another Ruby porter, 2008-9-c

    ■ [Ruby] gemのパッケージを展開する Gem::Installer#unpackを使うと簡単です。 require "rubygems/installer" Gem::Installer.new("classx-0.0.4.gem").unpack("classx-0.0.4") コマンドラインのほうがもっと簡単。 % gem unpack classx-0.0.4.gem Unpacked gem: '/tmp/classx-0.0.4' % ls classx-0.0.4 ChangeLog README Rakefile bench doc example lib spec tasks 見てわかるとおり上はこっちから逆に導き出したもんなんだけど。 ■ [C] CSpec : Behavior-driven development in C これはどうだろうねえ。 Overv

    ita-wasa
    ita-wasa 2008/09/22
    % gem unpack classx-0.0.4.gem Unpacked gem: '/tmp/classx-0.0.4' まえにどんな形式なんだ? と思ったなぁ。
  • Testing: One expectation per test

    In a previous entry I discussed why I prefer One Assertion Per Test. In that entry I give a few state based examples, but didn't address the topic of mocks. This entry is going to focus on how you can use mocks while maintaining focus on maintainability. Let's start with an example. require 'test/unit' require 'rubygems' require 'mocha' module Expectations class SuiteRunner attr_accessor :suite de

    ita-wasa
    ita-wasa 2008/07/29
    Writing tests in this way is actually quite easy if you follow a few simple suggestions. * If your test has an assertion, do not add any mock expectations (instead use stubs for any methods that need to be changed for the test). * If you add a mock expectation you probably don't need it to r
  • はてなブログ | 無料ブログを作成しよう

    京都市の美味しいパティスリーを紹介したい 前編(北側エリア) こんばんはぁ、ぺのぽすです 京都大学に入学してそろそろ4年目、趣味のパティスリー巡りをしてて気づいたことがあります。 京都市のパティスリー、レベル高すぎ!! 京都市はホントどこに行ってもで~~ら美味しいパティスリーがあり大体の観光、ご飯のついでに激ウマ…

    はてなブログ | 無料ブログを作成しよう
    ita-wasa
    ita-wasa 2007/06/15
    AP4Rのサンプルアプリを作ってもらっている、ありがたい
  • 1