Module: MustacheRender::RenderAble::ForRecord::ClassMethods

Defined in:
lib/mustache_render/ables/render_able.rb

Overview

类方法

Instance Method Summary collapse

Instance Method Details

#load_mustache_populator(*args, &block) ⇒ Object

options:

- populators:


39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/mustache_render/ables/render_able.rb', line 39

def load_mustache_populator *args, &block
  options = ::MustacheRender::ArrayUtil.extract_options!(args)

  (
    ::MustacheRender::ArrayUtil.init(options[:populators]).compact
  ).each do |populator_moule|
    self.send :include, populator_moule if populator_moule.is_a?(Module)
  end

  if block_given?
    block.call(
      self.mustache_populator_config
    )
  end
end

#mustache_populator_configObject



55
56
57
# File 'lib/mustache_render/ables/render_able.rb', line 55

def mustache_populator_config
  @mustache_populator_config ||= ::MustacheRender::RenderAble::MustachePopulatorConfig.new
end

#mustache_populator_filters_utilObject



59
60
61
# File 'lib/mustache_render/ables/render_able.rb', line 59

def mustache_populator_filters_util
  self.mustache_populator_config.filters_util
end