【发布时间】:2015-03-30 21:22:36
【问题描述】:
我现在正在基于健康数据标准库 (https://github.com/projectcypress/health-data-standards.git) 进行开发。在文件 lib/health-data-standards/export/helper/scooped_view_helper.rb (https://github.com/projectcypress/health-data-standards/blob/master/lib/health-data-standards/export/helper/scooped_view_helper.rb) 第 90 行中,调用了 patient.entries_for_oid。但是方法没有定义。
在 Pry 环境下,我尝试了“edit patient.entries_for_oid”。编辑器在第 166 行打开 memoist/lib/memoist.rb (https://github.com/matthewrudy/memoist/blob/master/lib/memoist.rb)。在那里我看到了这些代码:
module_eval <<-EOS, __FILE__, __LINE__ + 1
def #{method_name}(*args)
reload = Memoist.extract_reload!(method(#{unmemoized_method.inspect}), args)
skip_cache = reload || !(instance_variable_defined?(#{memoized_ivar.inspect}) && #{memoized_ivar} && #{memoized_ivar}.has_key?(args))
set_cache = skip_cache && !frozen?
if skip_cache
value = #{unmemoized_method}(*args)
else
value = #{memoized_ivar}[args]
end
if set_cache
#{memoized_ivar} ||= {}
#{memoized_ivar}[args] = value
end
value
end
EOS
end
但这没有意义,patient.entries_for_oid 真正做了什么。
有人知道吗?
谢谢
【问题讨论】:
标签: ruby-on-rails ruby