永井伸弥です。ハンドルネームはshinya_131です。
プログラマーです。マネージャーです。
ネイティブゲームを作っています。
ジャングルと権限委譲 - 宇宙は究極のフリーランチ
マネージメントについて今自分が考えている事を書いた記事。
Rubyの凄く面白い特徴をRailsのコードを例に解説
qiita記事。初のホッテントリ入り。
class ItemWithQuantity | |
attr_reader :item, :quantity | |
def initialize(item, quantity) | |
@item = item | |
@quantity = quantity | |
end | |
end |
class ItemWithQuantity | |
include Enumerable # 1.この組み込みライブラリをinclude | |
attr_reader :item, :quantity | |
def initialize(item, quantity) | |
@item = item | |
@quantity = quantity | |
end |
hp_recoveries = ItemWithQuantity.new("やくそう", 3) | |
hp_recoveries.map.with_index do |item, i| | |
p "#{item} No. #{i+1}" | |
end | |
#=> "やくそう No.1" "やくそう No.2" "やくそう No.3" |
class MyClass | |
def public_my_method | |
p "public!" | |
end | |
private | |
def private_my_method | |
p "private!" | |
end |
### 1) Rack::Request, ActionDispatch::Request(plain rails) diff | |
Rack::Request.instance_methods.count #=> 154 | |
ActionDispatch::Request.instance_methods.count #=> 231 | |
ActionDispatch::Request.instance_methods - Rack::Request.instance_methods | |
#=> [:ignore_accept_header, :ignore_accept_header=, :auth_type, :gateway_interface, | |
# :path_translated, :remote_host, :remote_ident, :remote_user, :remote_addr, | |
# :server_name, :server_protocol, :accept, :accept_charset, :accept_language, | |
# :cache_control, :from, :negotiate, :pragma, :key?, :request_method_symbol, |
require 'pry' | |
def target_root_dir | |
"./" | |
end | |
# make archive directorty | |
def archive_dir_name | |
dir = Time.now.strftime("%Y_%m_%d") | |
File.join(target_root_dir, dir) |
# == seed picker == | |
# railsのseed ファイルの中から指定したidのrecordに相当する部分のみを取り出します | |
# | |
# TODO: 指定したidが見つからない場合にエラーになるようにする | |
# | |
# #例 | |
# <data source> | |
# /Users/nagai_shinya/my_rails_app/db/seeds/products.yml | |
# | |
# ```` |
#require 'pry' | |
#require 'pp' | |
# 指定したディレクトリをrootとしてroot以下にあるファイルすべてについて、 | |
# ディレクトリ分けが無視されて、ファイル名だけで区別されるようになった場合に、ファイル名の重複が起きないかチェックする。 | |
# | |
# e.x. | |
# # 実際のディレクトリ/ファイル構成 | |
# root/ | |
# root/category_a/ |
永井伸弥です。ハンドルネームはshinya_131です。
プログラマーです。マネージャーです。
ネイティブゲームを作っています。
ジャングルと権限委譲 - 宇宙は究極のフリーランチ
マネージメントについて今自分が考えている事を書いた記事。
Rubyの凄く面白い特徴をRailsのコードを例に解説
qiita記事。初のホッテントリ入り。