Created
February 15, 2012 01:43
-
-
Save koko1000ban/1832414 to your computer and use it in GitHub Desktop.
test_area_getter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Ekispert | |
# よく考えると地域だからインスタンス化されるような使い方はないか.. | |
module Area | |
LIST = [{ :name => :japan, :yomi => "全国", :code => 111 ..}, ..] | |
# クラスメソッドのかきかたわすれた.. | |
module_function | |
def find(&block) | |
# クロージャで取捨選択 | |
end | |
# ActiveRecordみたいにfind_by_xxxを自動生成しても | |
def find_by_code(code) | |
LIST.find{ |lst| lst.code == code } | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment