My question is similar to "What is the difference between include and extend in Ruby?". What's the difference between require and include in Ruby? If I just want to use the methods from a module in my class, should I require it or include it?
![What is the difference between include and require in Ruby?](https://cdn-ak-scissors.b.st-hatena.com/image/square/98d6f053a97a87156775f60757c60865d0f2c47d/height=288;version=1;width=512/https%3A%2F%2Fcdn.sstatic.net%2FSites%2Fstackoverflow%2FImg%2Fapple-touch-icon%402.png%3Fv%3D73d79a89bded)
The Photoshop file format is no longer opaque. Adobe's PSD format has been a black box for ages. We've built a Ruby library that opens up the PSD format and allows you to easily work with Photoshop documents. Get it Download .zip Download .tar.gz View on GitHub PSD.rb is a general purpose Photoshop file parser written in Ruby. It allows you to work with a Photoshop document in a manageable tree st
Ruby 2.1 のすべて Koichi Sasada Heroku, Inc. ko1@heroku.com tochigirubykaigi05 2013/09/21 1 About this presentation • In this presentation, I will show you about Ruby 2.1 which I know. tochigirubykaigi05 2013/09/21 2 Ruby 2.1 release plan announcement “I, Naruse, take over the release manager of Ruby 2.1.0 from mame. Ruby 2.1.0 is planed to release in 2013-12- 25. I‘m planning to call for feature prop
Ruby中級入門 1. Ruby中級入門 @shokai 2013年8月5日(火) @masuilab 2. 私 •@shokai (しょうかい) •趣味:料理、glitch 3. ある程度大きなアプリケーションを作 っていると、部品に分割したくなると 思います。アプリ内ライブラリやgem の作り方を説明します。Rubyの機能を 活用した使い勝手の良いライブラリの デザインについて考えます。 4. • アプリ内ライブラリの作り方・gemの作り方 • サンプルコードとテスト • ライブラリのデザイン • API • DSL • 泥臭い小手先の技 • 例外・エラーの通知 • ドキュメント コンテンツ 5. ライブラリを作る 例:LeapMotionを自作アプリに組み込むための アプリ内ライブラリを作る 6. • LeapMotionはport 6437にWebSocket 接続するとJSONで
I'm new to ruby on rails but I want to send the data from my SQlite database from my iphone app to the rails web app. Like a "sync" service. I'm using devise for authentication for the web app. I enabled basic HTTP authentication and I can curl into the website for xml or json data. I can also upload data to the website when I set the post headers to JSON and with username and password. Here's whe
<< 2013/07/ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 1. mrubyのmrb_gc_arena_save()/mrb_gc_arena_restore()の使い方 >> _ mrubyのmrb_gc_arena_save()/mrb_gc_arena_restore()の使い方 Twitterで質問を受けたので、 mrubyのmrb_gc_arena_save()/mrb_gc_arena_restore()の使い方 という解説を行った。が、1つ140文字のTwitterでの解説にはどうしても無理があるので、 こっちでまとめることにする。 まずは、Twitterの発言*1はこんな感じ。 arenaの目的。利用中のオブジェクトはGCに回収されないよう保護
Draperって何?Draperは、Model/Controller/View/Helperと異なる第4のレイヤを提供するGemです。 この第4のレイヤは、海外では「Presenter」として分類されています。(正確にもう少し細かい分類があるらしいですが割愛♪) このレイヤを作るメリットは、 model/viewに余計なロジックを書かなくてすむ Helperのメソッドが使われている場所が不明という事態を防ぐ 日本ではPresenterレイヤでは、ActiveDecoratorというGemが有名です。ActiveDecoratorもほぼ同じことができます。 Draperの紹介Draperの説明ならRailsCastが一番わかり易かったです(説明は日本語に翻訳されています、動画は英語です)↓ #####286 Draper - RailsCasts 1年前の記事ですので、実際に動かしてみると少
こちら。 こんな感じにRubyスクリプトでNICを設定できるぜいえーい eth = Netif.new("eth0") eth.up eth.mtu = 1000 eth.set_addr("172.0.0.1", "255.255.255.0") puts "addr:#{eth.addr}" puts "netmask:#{eth.netmask}" puts "broadaddr:#{eth.broadaddr}" puts "promisc?:#{eth.promisc?}" puts "up?:#{eth.up?}" puts "eth3 exists?:#{Netif.exists?("eth3")}" 取り敢えずLinuxとFreeBSDでのみ動きます。他のOSは知りません。前回の記事でNetlinkとか騒いでたくせにLinux版でNetlink使ってません(死) どなたかN
4. Module#prepend 2013/03/01 シナジーマーケティング(株) 寺岡 佑起 [Ruby 2.0] 第4章 Module#prepend 4.1. Module#prependとは 4.2. prependとincludeの違い 4.3. モジュールの仕組み 4.4. モンキーパッチに利用する 4.5. まとめ 4.1. Module#prependとは Ruby2.0で追加されたModule#prependは、Module#includeと非常によく似た機能です。 Module#prependを使うと既存のクラスの処理を変更することができます。 Module#prependでメソッドを追加する prependを利用するのに特に難しいことは必要ありません。 以下のようにprependにモジュールを指定するだけです。 module Greeting def greet
ツイッターで「Ruby の Hash のキーにするオブジェクトに hash と eql? を定義しないといけないのなんでなんだろう」という話題が出て、「おそらく Hash の名前の通り、Hash テーブルを lookup するのにキーの hash 値を計算するのに使ってるんだろうね」という話になったのだけれど、「じゃあhash.c 読んでみようぜ」って感じになって、一部読んだ。2.0.0-p0のコードです。 (一部markdownが注釈と解釈されておかしなことになってるの防ぐためにスペースを余分に入れてある) まずは、Hash#[ ] の実装がどこにあるのか見る。 hash.c の 3448 行目見るとわかる。 rb_define_method(rb_cHash,"[ ]", rb_hash_aref, 1); Hash#[ ] の実体は rb_hash_aref というCの関数である。じ
Speak with us to find out how we can best assist you in setting up our serverless IronWorker that scales based on your needs. The Original Setup First, a little background: we built the first version of IronWorker, originally called SimpleWorker (clever name right?), with Ruby. We were a consulting company building apps for other companies and there were two really hot things at that time: Amazon
A Better Way to Monitor God is an easy to configure, easy to extend monitoring framework written in Ruby. Keeping your server processes and tasks running should be a simple part of your deployment process. God aims to be the simplest, most powerful monitoring application available. Tom Preston-Werner tom@mojombo.com Google Group: http://groups.google.com/group/god-rb Features Config file is writte
CategoriesTo give you an overview of what open source libraries are available for a given task we group projects for common problems into categories. The catalog itself is available for contributions on GitHub. SearchWith our search you can find Ruby open source libraries beyond what is listed in our categories. We index all Rubygems published on Rubygems.org. Project PopularityWe sort projects ba
はじめに 本文書は、Rubyによりコーディングを行う際の規約について述べる。 実際のプロジェクトに適用する際には、このコーディング規約をカスタ マイズして用いることを推奨する。 ソースコードの整形 インデント プログラムを読みやすくするため、インデントを適宜行う。インデント 幅は2とする。また、インデントにはスペースのみを使用し、タブは使用 しない。(環境によりタブ幅が異なるため。) 例: if x > 0 if y > 0 puts "x > 0 && y > 0" end end 一行の桁数 一行の桁数は最大80桁までとする。 空行 複数のクラスの区切には空行を挿入する。 例: class Foo ... end class Bar ... end 誤った例: class Foo ... end class Bar ... end また、クラス内の各構成要素の区切にも空行を挿入する。
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く