【文件属性】:
文件名称:hash_param:将Hash对象转换为形式参数
文件大小:8KB
文件格式:ZIP
更新时间:2021-05-11 20:56:44
Ruby
hash_param
hash_param是一个库,可将带有单个“数据”参数Hash的函数转换为带有命名形式参数的函数。 这样可以使ActionCable之类的API更加易于使用。
例如,它可以将其变为:
class ChatChannel < ApplicationCable :: Channel
def send_message ( data )
chat_id = data [ 'chat_id' ]
author_id = data [ 'author_id' ]
body = data [ 'body' ]
# ...
end
def typing_status ( data )
chat_id = data [ 'chat_id' ]
user_id = data [ 'user_id' ]
status
【文件预览】:
hash_param-master
----hash_param.gemspec(918B)
----LICENSE.txt(1KB)
----lib()
--------hash_param.rb(4KB)
--------hash_param()
----Gemfile(38B)
----Rakefile(198B)
----.travis.yml(76B)
----test()
--------test_helper.rb(108B)
--------hash_param_test.rb(3KB)
----README.md(3KB)
----.gitignore(87B)
----bin()
--------console(335B)
--------setup(115B)