class SknRegistry::Content

Child to contain contents

Attributes

item[R]
options[R]

Public Class Methods

new(item, options = {}) click to toggle source
# File lib/skn_registry.rb, line 75
def initialize(item, options = {})
  @item    = item
  @options = { call: item.is_a?(::Proc) }.merge(options)
end

Public Instance Methods

call(render_proc=true) click to toggle source

Determine if call is required, without changing original values

  • yes, determine if depends are available – yes, call with depends: item.call(depends) – no, just item.call()

  • no, return item

# File lib/skn_registry.rb, line 85
def call(render_proc=true)
  _opts    = options.reject {|k,v| k === :call }
  _do_call = render_proc && options[:call]

  _do_call ? (_opts.empty? ? item.call : item.call( _opts )) : item
end