変数を含むハッシュ値があります:
module Categories
module Services
PHOTOGRAPHY_VIDEO = "9115"
end
end
hash = {"CatId" => Categories::Services::PHOTOGRAPHY_VIDEO}
puts(hash["CatId"]) # This returns "9115" but how do I get the "Services" category?
「Services」に等しい「CatId」の変数「value」の名前空間をRubyに問い合わせたい。私はこのようなことをしたい:
def priced?
(hash["CatId"]).unknown_method == Services
end
名前空間を取得するにはどうすればよいですか?