タグ

rubyに関するsatoshipのブックマーク (208)

  • Ruby のアスタリスクオペレータ(*) のメモ - わからん


     reference - Tricky operators in Ruby - Stack Overflow  stackoverflow   Tricky  Sbastien Le Callonnec  * ! a,b,c = *[1,2,3] a # => 1 b # => 2 c # => 3 *d = 1,2,3 d # => [1, 2, 3] 使  case  first = ["one", "two"] second = ["three", "four"] number = "one" p case number when *first "first" when *second "secon
  • クラスのインスタンス変数について

    アプリ開発者、DB 管理者視点での Cloud Spanner 活用方法 | 第 10 回 Google Cloud INSIDE Games & App...Google Cloud Platform - Japan

    クラスのインスタンス変数について
  • コーディング規約をまとめてみた (Ruby編) - bojovs::blog


          Ruby RailsCoffeeScript Ruby https://github.com/styleguide/ruby https://github.com/bbatsov
  • The End of Monkeypatching

    Ruby Weekly is a weekly newsletter covering the latest Ruby and Rails news. Monkey-patching is so 2010. We're in the future, and with Github and Bundler there is now rarely a need to monkey-patch Ruby code in your applications. Monkey-patching is the dangerous-yet-frequently-useful technique of re-opening existing classes to change or add to their behavior. For example, if I have always felt that

  • まつもと直伝 プログラミングのオキテ 第21回 オープンクラスとRuby on Rails


    Ruby使RubyonRailsActiveSupport RubyFoo FooFooBarFooBardefplus2FooBarFooBarplus2使 
    まつもと直伝 プログラミングのオキテ 第21回 オープンクラスとRuby on Rails
  • [ruby][howto]クラスを生成するクラスの作り方


    Ruby Ruby  Active Record Active Record  DB DB()Active Record  Rails  ActiveRecord::Base ()
    [ruby][howto]クラスを生成するクラスの作り方
  • Ruby's new as a factory

  • シンタックスハイライトを実装する(Ruby & Parslet 編) | Webシステム開発/教育ソリューションのタイムインターメディア

    問題 世の中にはシンタックスハイライトを行うツールが既に多数存在しています。例えば以下のようなものがあります: GNU Source-highlight (コマンドラインツール)SHJS (JavaScriptでの実装; クライアントサイドで動的にハイライトする)SyntaxHighlighter (SHJSと同様) メジャーな言語やフォーマットなら標準でシンタックスハイライトの設定が同梱されていますが、 ニッチな言語やフォーマットだとまずそのような設定は存在しません。 それならば独自に設定を書けばいいのですが、 大抵のツールでは構文の定義方法が特定のパーツに該当する正規表現を並べるだけなので、 言語によっては構文の妥当な記述が不可能な場合もあります。 となると独自に実装せざるを得ません。 例えば Vim の :help ドキュメントを良い感じに Web ブラウザ上で見るためのツール を作

    シンタックスハイライトを実装する(Ruby & Parslet 編) | Webシステム開発/教育ソリューションのタイムインターメディア
  • 第19章 スレッド


    ruby  CPU CPU       CPU  ruby  
  • るびま


    Ruby Rubyist  Rubyist Magazine  Rubyist Magazine Ruby  Rubyist  Rubyist Rubyist   Rubyist Magazine 0058   Rubyist Magazine 0058  RubyKaigi 2018  Rubyist Magazine 0057  RubyKaigi 2017  Rubyist Magazine 0056  Rubyist Magazine 0055  Rubyist Magazine 0054   Ruby 11
  • 極めるメソッド


    $Id: method.rd,v 1.4 2003/06/18 23:28:28 aamine Exp $ 2使   Ruby  def method_name( arg, arg, opt_arg = default, *rest_args, &block_arg )  end     使   opt_arg  rest_args 
  • Ruby用拡張ライブラリをCで作る --- Little Penguin

    Ruby用拡張ライブラリをCで作る Helloクラス Rubyのソースにしてみればおそろしく簡単な下記のソースを、今回はCで記述し てみることにする。 class Hello def hello print "Hello, Ruby World.\n" end end 完成品のソース(hello_rb.c) #include <stdio.h> #include <ruby.h> VALUE hello(void); Init_Hello(){ VALUE cHello; cHello = rb_define_class("Hello", rb_cObject); rb_define_method(cHello, "hello", hello, 0); } VALUE hello(void){ printf("Hello, Ruby World.\n"); return Qnil; } ソ

  • SOCKSify Ruby

    What is it? SOCKSify Ruby redirects any TCP connection initiated by a Ruby script through a SOCKS5 proxy. It serves as a small drop-in alternative to tsocks, except that it handles Ruby programs only and doesn't leak DNS queries. How does it work? Modifications to class TCPSocket: Alias initialize as initialize_tcp The new initialize calls the old method to establish a TCP connection to the SOCKS

  • Pry - an IRB alternative and runtime developer console

    Pry is a powerful alternative to the standard IRB shell for Ruby. It features syntax highlighting, a flexible plugin architecture, runtime invocation and source and documentation browsing. Quickstart Install Pry: $ gem install pry $ pry Try it out: (Displaying source for FileUtils.rm) pry(main)> cd FileUtils pry(FileUtils):1> show-method rm From: /opt/ruby/lib/ruby/1.9.1/fileutils.rb @ line 556: N

  • YARD - A Ruby Documentation Tool

    What Is YARD? YARD is a documentation generation tool for the Ruby programming language. It enables the user to generate consistent, usable documentation that can be exported to a number of formats very easily, and also supports extending for custom Ruby constructs such as custom class level definitions. Above is a highlight of the some of YARD's notable features. And of course YARD comes with muc

  • GitHub - rbenv/rbenv: Manage your app's Ruby environment

    You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert

    GitHub - rbenv/rbenv: Manage your app's Ruby environment
  • Setting up a new machine for Ruby development

    It used to be a jarring experience to setup a new machine for development, but progress has paved the dirt road into a silky smooth autobahn. These are the tools we use today: Homebrew: Remember how painful it used to be to get imagemagick installed? Now it takes about a minute. “brew install imagemagick”. Same story for git and other Linux dependencies. rbenv/ruby-build: We have some apps running

    Setting up a new machine for Ruby development

  • DateTimeActiveSupport Rational require 'date' t = DateTime.now # 1 t >> 1 # 1 t + 1 # 1 (1/24) t + Rational(1, 24) # 1 (1/1440) t + Rational(1, 24 * 60) # 1 (1/86400) t + Rational(1, 24 * 60 * 60) Ruby DateTime  http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-list/44399 T
    DateTime に月、日、時、分、秒を足す。 - こせきの技術日記
  • 俺でも分かるRakeの使い方 - とある技術の備忘録

    Ruby目次 Rakefileの簡単な書き方 名前空間 - Rakefileが増えてきたら ブロック引数 - D・R・Y! D・R・Y! タスクの動的生成 ありがとう参考先------------------------------------------------------------ Rakeというのはrubyで処理内容を定義できるビルドツール。currentDirectoryのRakefileというタスクを定義したファイルを読み込んで色々タスクを実行してくれます。引数でファイル名を指定できるけど、基的にはRakefileがデフォルトなのでそれに従った方がいいです。 $ rake タスク名> # 指定のタスクを実行。 $ rake パラメータキー>=値> タスク名> # パラメータ指定ありで、指定のタスクを実行。 $ rake -h # 使い方を表示。 $ rake -T # 定

  • Ruby においてメソッドがどこで定義されているのかを調べる方法 - vivid memo

    ruby-talk の 381425 で 「どのメソッドが呼び出されているのか調べる方法を知りたい」 という内容の質問がありました。 私も知らなかったのですが、Method オブジェクトを使えば簡単に知ることができるそうです。 というわけで、メソッドがどこで定義されているのかを調べる方法を書いておきます。 メソッドを定義しているクラスまたはモジュールへの参照を取得する あるメソッドがどのクラス (またはモジュール) で定義されているかを知りたければ、そのメソッドに対応する Method オブジェクトを取得し、Method#owner メソッド を呼び出します。 それだけで、メソッドを定義しているクラス (またはモジュール) への参照を取得できます。 ちなみに、ある名前のメソッドに対応する Method オブジェクトを取得するには、Kernel#method メソッド を使用します。 'あい

    Ruby においてメソッドがどこで定義されているのかを調べる方法 - vivid memo