Tbpgr Blog

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

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

TbpgrUtils | 追加要件 EvalHelper#each_brace_code 追加

概要 追加要件 EvalHelper#each_brace_code 追加 詳細 追加要件 EvalHelper#each_brace_code を追加します 仕様 ・each文でブレースを利用した1行のコードを生成します。※より詳細についてはGitHubのREADMEおよびテストケース参照 GitHub https://github.com…

ActiveSupport | Enumerable#sum

概要 Enumerable#sum 詳細 Enumerable#sum について Enumerable#sum 対象を合計した結果を返却します。 +演算子を利用しているため、文字列も連結します。 ブロックの指定も可能です。 空要素の場合はデフォルトでゼロを返却しますが、初期値を引数に渡すこ…

TbpgrUtils | 追加要件 EvalHelper#set_variables_code 追加

概要 追加要件 EvalHelper#set_variables_code 追加 詳細 追加要件 EvalHelper#set_variables_code を追加します 仕様 ・set_variables_codeを利用して変数を設定するコードを一括で生成します。※より詳細についてはGitHubのREADMEおよびテストケース参照 Gi…

ActiveSupport | ordinalize

概要 ordinalize 詳細 ordinalize について ordinalize 数値を序数のサフィックス付きのフォーマットにします。 サンプル # encoding: utf-8 require 'active_support/core_ext/integer/inflections' require 'tbpgr_utils' I18n.enforce_available_locales …

TbpgrUtils | 追加要件 EvalHelper#set_variable_code を追加

概要 追加要件 EvalHelper#set_variable_code を追加 詳細 追加要件 EvalHelper#set_variable_codeを追加します 仕様 ・set_variable_codeを利用して変数を設定するコードを生成します。※より詳細についてはGitHubのREADMEおよびテストケース参照 GitHub htt…

ActiveSupport | ordinal

概要 ordinal 詳細 ordinal について ordinal 序数のサフィックスを取得します。 サンプル # encoding: utf-8 require 'active_support/core_ext/integer/inflections' require 'tbpgr_utils' bulk_puts_eval binding, <<-EOS 1.ordinal 2.ordinal 3.ordinal…

TbpgrUtils | 追加要件 EvalHelper#times_code を追加

概要 追加要件 EvalHelper#times_code を追加 詳細 追加要件 EvalHelper#times_codeを追加します 仕様 ・times_codeを利用したコードをを生成します。※より詳細についてはGitHubのREADMEおよびテストケース参照 GitHub https://github.com/tbpgr/tbpgr_utils…

ActiveSupport | multiple_of?

概要 multiple_of? 詳細 multiple_of? について multiple_of? 数値が引数の数値の倍数であるか判定する サンプル # encoding: utf-8 require 'active_support/core_ext/integer/multiple' require 'tbpgr_utils' bulk_puts_eval binding, <<-EOS 1.multiple_…

TbpgrUtils | 追加要件 EvalHelperをObjectに追加

概要 追加要件 EvalHelperをObjectに追加 詳細 追加要件 EvalHelperをObjectに追加します 仕様 ・Objectに追加することで、includeせずに利用できるようになります。※より詳細についてはGitHubのREADMEおよびテストケース参照 GitHub https://github.com/tbp…

ActiveSupport | formatting

概要 formatting 詳細 formatting について formatting 数値を任意のフォーマットに変更する フォーマット フォーマット phone currency percentage delimited rounded human_size human ※実際の出力内容はサンプルコード参照 操作 メソッド 内容 since 指定…

TbpgrUtils | 追加要件 EvalHelper#require_relative_code

概要 追加要件 EvalHelper#require_relative_codeを追加 詳細 追加要件 EvalHelper#require_relative_codeを追加します 仕様 ・requireの文字列を生成します ・引数でrequireするファイル名を指定します。複数指定すると複数のrequire文が生成されます。※よ…

ActiveSupport | time

概要 time 詳細 time について time 数値を元にして日時を扱う。 単位 メソッド 内容 seconds 秒 minutes 分 hours 時 days 日 weeks 週 week 週(weeksのエイリアス) fortnights 2週間 months 月 years 年 ※補足 fortnight => 2週間の意 操作 メソッド …

TbpgrUtils | 追加要件 EvalHelper#require_code

概要 追加要件 EvalHelper#require_codeを追加 詳細 追加要件 EvalHelper#require_codeを追加します 仕様 ・requireの文字列を生成します ・引数でrequireするファイル名を指定します。複数指定すると複数のrequire文が生成されます。※より詳細についてはGit…

ActiveSupport | bytes

概要 bytes 詳細 bytes について bytes 数値を単位ごとのバイト数に変換する。・bytes ・kilobytes ・megabytes ・gigabytes ・terabytes ・petabytes ・exabytes サンプル # encoding: utf-8 require 'active_support/core_ext/numeric/bytes' require 'tbp…

TbpgrUtils | 追加要件 EvalHelper#ternary_operator

概要 追加要件 EvalHelper#ternary_operatorを追加 詳細 追加要件 EvalHelper#ternary_operatorを追加します 仕様 ・三項演算子の文字列を生成します ・引数で三項演算子の条件、真の場合の文字列、偽の場合の文字列を渡します ・オプション引数で戻り値の変…

ActiveSupport | String#conversion

概要 String#conversion 詳細 String#conversion について String#conversion Date._parseを便利にしたラッパーのようなメソッド。 サンプル # encoding: utf-8 require 'active_support/core_ext/string/conversions' require 'tbpgr_utils' bulk_puts_eval…

TbpgrUtils | 追加要件 EvalHelper#unless_code_after

概要 追加要件 EvalHelper#unless_code_afterを追加 詳細 追加要件 EvalHelper#unless_code_afterを追加します 仕様 ・後置unless文の文字列を生成します ・引数でunless文の条件、unlessの場合の文字列、elseの場合の文字列を渡します※より詳細についてはGi…

ActiveSupport | String#foreign_key

概要 String#foreign_key 詳細 String#foreign_key について String#foreign_key 文字列から外部キー用の文字列を取得する。 サンプル # encoding: utf-8 require 'active_support/core_ext/string/inflections' require 'tbpgr_utils' bulk_puts_eval bindi…

TbpgrUtils | 追加要件 EvalHelper#unless_code

概要 追加要件 EvalHelper#unless_codeを追加 詳細 追加要件 EvalHelper#unless_codeを追加します 仕様 ・unless文の文字列を生成します ・引数でunless文の条件、unlessの場合の文字列、elseの場合の文字列を渡します※より詳細についてはGitHubのREADMEおよ…

書評 実践Vagrant

概要 実践VagrantはVagrantの作者であるMitchell Hashimotoさんの著書の和訳版。 原書に加えて、 ・伊藤直也さんによるAWSでの利用方法 ・吉羽龍太郎さんによるVagrantプラグイン、Packerの紹介 などが追加されています。 構成 1章:Vagrantの紹介 2章:初め…

ActiveSupport | String#humanize

概要 String#humanize 詳細 String#humanize について String#humanize 属性の名前を人が見やすい形式に変換する。 アンダースコアをスペースに変更し、 _idを削除し、 先頭の単語をCapitalizeします。 サンプル # encoding: utf-8 require 'active_support/…

TbpgrUtils | 追加要件 EvalHelper#if_code_after

概要 追加要件 EvalHelper#if_code_afterを追加 詳細 追加要件 EvalHelper#if_code_afterを追加します 仕様 ・後置if文の文字列を生成します ・引数でif文の条件、真の場合の文字列を渡します※より詳細についてはGitHubのREADMEおよびテストケース参照 GitHu…

ActiveSupport | String#constantize

概要 String#constantize 詳細 String#constantize について String#constantize 文字列から定数を取得する サンプル # encoding: utf-8 require 'active_support/core_ext/string/inflections' require 'tbpgr_utils' class Hoge HIGE = "hige" end bulk_pu…