In a previous post, I wrote a bit about how Ruby objects are laid out in memory. Today we’ll use that information to write a program that will allow us to take a Ruby heap dump and visualize the layout and fragmentation of that heap. Ruby Object Layout Recap Just as a recap, Ruby objects are fixed width. That is, every Ruby object is the same size: 40 bytes. Objects are not really allocated with m
rubyでは、あるオブジェクトが持つメソッドのソースがどこにあるのかは、自明ではなかったりします。 includeだのprependだのが使われていると追いにくかったり、、 pryを使う場合: show-methodを使う 使い方: rails cした後に show-method [メソッド名] と入力します。 [/Users/cesario/go/src/github.com/hoshinotsuyoshi/s3_explorer]$ bin/rails c Running via Spring preloader in process 41502 Loading development environment (Rails 5.0.1) [1] pry(main)> show-method ''.to_json From: /Users/cesario/go/src/github.co
思い出話とか こんにちは、近ごろ寒くてハーパンからジーパンに衣替えした @takano32 です。 さて、久しぶりに Ruby について何か書くような気がするこの頃ですが、ふと昔の事を思い出していました。 いまでは Ruby on Rails とかでインターネットを賑わせている言語となりましたが、バージョン 1.2 くらいのときはオブジェクト指向できれいなプログラミングができるし UNIX とも仲良しな言語として使われていました。Perl のように $ ではじまる省略された記法で文字列処理もできるし、 class を定義して、なんだか簡単にきれいなオブジェクト指向のプログラミングもできます、みたいな感じ。Java とかは static public void main とか面倒だからいらない。 その後にキラーアプリとして RWiki とか tDiary がでてきて、なんかこう「あの、はてな
この記事は feedforce Advent Calendar 2016 - Adventar の2日目の記事です。 1日目は 源義経のシンプルな考え方が好き - Marketing book でした。良い話だ。(ちなみに大河ドラマが平清盛だった年は、我が家では後白河院の評価が高かったです。懐かしい。) RubyCriticのご紹介 rubyエンジニアなのでrubyのことを書きます。 RubyCriticはrubyコードを静的解析するツールです。rubygemで提供されています。 単純な使い方としては、$ gem install rubycritic するなりbundler使うなりしてインストールし、 $ rubycritic . を実行します。$ rubycritic ./app ./lib のように、指定のディレクトリだけを対象にして実行することもできます。 実行すると./tmp/ru
RubyKaigi 2016 に参加してたのですが、最近までISUCON予選あったり自分がメインで関わってるアプリのリリースとかあったりで今更振り返りです rubykaigi.org 0日目(前日) 1日目 弊社ブースについて 2日目 RubyKaraoke 2016 3日目 その他 0日目(前日) 知り合い何人かとairbnbで宿をとってたんだけど(宿主の名前をとって通称モリタハウス)、ホストから当日朝にドタキャン喰らった。FBのモリタハウス連絡部屋が朝からハチャメチャ大混乱 詳細 chiastolite.hatenablog.com 1日目 聞いたセッション dRuby in the last century. Welcome to haconiwa - the (m)Ruby on Container A proposal of new concurrency model for R
日本じんRubyプログラマー、どうもありがとうございます! Rubyがだいすきです。日本語がよくわかりません。だから、これは推測です。すみません! TLDR: The best front-end compilers come from the JavaScript world. Use words accurately. Eschew hate. Forget MINASWAN, because Ruby is 和. Learn Japanese. don't save sprockets The good folks at Arkency recently got in touch and asked if I wanted to include my book Rails As She Is Spoke in their Rails Book Bundle. I was deligh
こんにちは、RuboCop大好き!Pockeです。 先日、RuboCopのバージョン0.43.0がリリースされました。 Release RuboCop 0.43 · bbatsov/rubocop このリリースには、筆者を始めとするSideCIのメンバーによるPull Requestも11個含まれています。 今日はそのCHANGELOGから、気になる新機能を見ていきましょう。 新規Cop追加 Copとは、RuboCopにおいてひとつのルールを指す言葉です。例えば、「インデントが正しいかチェックする」「非推奨メソッドを使っていないかチェックする」などが1つのCopの単位になります。 この章では、0.43.0で新たに追加されたCopをひとつずつ紹介します。 Style/DocumentationMethod PR https://github.com/bbatsov/rubocop/pull/
This article was originally published on Chaps by Maciej Nowak, and with their permission, we are sharing it here for Codeship readers. Have you ever struggled with a chain of rake tasks that needed to be run periodically and their runtime was giving you a headache? Did you ask yourself how to save time by boosting execution along with readability for huge chunks of jobs? These questions are very
Update (November 18th, 2015): Since these new methods have been announced a few people have expressed concerns that they would interfere with Hash#sort. I addressed those concerns in an addendum to this post below. It’s been over a year since I wrote my initial “Proposal for a better Ruby Hash#include?” and I’m so happy to announce that since Tuesday November 10, 2015, Hash comparison methods have
For a very long time the only way to extend Ruby with native estensions has been using C. I don’t have the numbers with me, but I guess C is not the first choice for Ruby programmers when they have to pick up a secondary/complentary language. So I started investigating the possibility of writing them in other languages, taking advantage of the favorable moment: in the past 3-4 years we had an expl
Go and Ruby-FFI How to write a shared library in Go that can be loaded by Ruby-FFI. With the release of Go 1.5 we got access to a new buildmode called c-shared, which allows you to build shared libraries that Ruby-FFI can load. (Also, anything else that can load shared libraries) Inspiration Filippo Valsorda has already written a very nice article on Building Python modules with Go 1.5 but I natur
tl;dr 変更したファイルにrubocopやjscsを実行して、pull requestに自動でコメントさせる方法。 コマンドをパイプでつないで、CIからsaddlerコマンドで書き込みする。 デモリポジトリに rubocop, travis ci, jscs, travis ci エラーになるpull requestしてみてね! saddlerの実行結果イメージ 一番目がjscs, 二番目がrubocop。 流れ diffのあるファイル名を取り出す $ git diff --name-only origin/master README.md bin/run-tests.sh lib/example/travis_ci.rb こんなdiffにrubocop や jscsを実行したい。 diffのあるファイル名を取り出す。 lint実行したいファイルだけに絞り込む $ git diff -
IRC (あいあーるしー) 「教養チャンネル」とも「衒学チャンネル」とも呼ばれる。ほとんどのタイミングで日本史か中欧史か仏教史か英語史の話をしている。たまにRubyの話題になると逆に違和感が… ISeq (あいせく) RubyVM::InstructionSequence のこと。長いので誰も正式名称で呼ぼうとしない。 rubyスクリプトのいくつかある表現型の中でもっとも低レベルな表現。現在、rubyスクリプトからISeqを生成する機能は公開されているが、そのようにして生成したISeqを実行する機能はセキュリティ上の懸念から(作られてはいるが)封印されている。→ AST ID (あいでぃー) 型。rubyレベルでいうSymbolにほぼ相当するもの(ちょっとだけ違う)。objcプログラマーはこれを見てVALUEと混乱しないように。 assn (あさしん) IRCで彼らがアサシンと呼んでいるも
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く