Tbpgr Blog

Employee Experience Engineer tbpgr(てぃーびー) のブログ

2014-10-01から1ヶ月間の記事一覧

Ruby | Object | public_method

概要 Object#public_method(name) -> Method 詳細 オブジェクトの public メソッド name をオブジェクト化した Method オブジェクトを返却 サンプルコード require 'tbpgr_utils' module Mod def mod 'mod' end end class Parent def parent 'parent' end en…

Ruby | Object | protected_methods

概要 Object#protected_methods(include_inherited = true) -> [Symbol] 詳細 protected メソッド名の一覧を返却。 include_inherited に false を指定すると自クラスのメソッドのみを返却 サンプルコード require 'tbpgr_utils' module Mod protected def m…

Ruby | Object | private_methods

概要 Object#private_methods(include_inherited = true) -> [Symbol] 詳細 private メソッド名の一覧を返却。 include_inherited に false を指定すると自クラスのメソッドのみを返却 サンプルコード require 'tbpgr_utils' module Mod private def mod; en…

Ruby | Object | nil?

概要 Object#nil? -> bool 詳細 レシーバが nil であれば真を返却。 サンプルコード class Hoge def public_hoge; end protected def protected_hoge; end private def private_hoge; end end print Hoge.new.nil?.grep /hoge/ 出力 $ ruby object_nil.rb ni…