Module: MustacheRender::RenderAble::ForRecord::InstanceMethods
- Defined in:
- lib/mustache_render/ables/render_able.rb
Instance Method Summary collapse
-
#mustache_populator_config ⇒ Object
组装器的配置.
-
#mustache_populator_filters_util ⇒ Object
组装器的过滤工具.
-
#to_mustache(options = {}, &block) ⇒ Object
options: - filter: - …
Instance Method Details
#mustache_populator_config ⇒ Object
组装器的配置
66 67 68 |
# File 'lib/mustache_render/ables/render_able.rb', line 66 def mustache_populator_config self.class.mustache_populator_config end |
#mustache_populator_filters_util ⇒ Object
组装器的过滤工具
71 72 73 |
# File 'lib/mustache_render/ables/render_able.rb', line 71 def mustache_populator_filters_util self.class.mustache_populator_filters_util end |
#to_mustache(options = {}, &block) ⇒ Object
options:
- filter:
- ...
- &block
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/mustache_render/ables/render_able.rb', line 79 def to_mustache ={}, &block result = ::MustacheRender::Mustache::Data.new( :nil? => false ) filter_util = self.mustache_populator_filters_util.load([:filter] || :default) self.impl_to_mustache result, filter_util, if defined?(self.impl_to_mustache) if block_given? if(_block_result = block.call :record => self, :result => result).is_a?(::Hash) result.merge! _block_result end end result end |