Class: SknRegistry::Content
Overview
Child to contain contents
Instance Attribute Summary collapse
-
#item ⇒ Object
readonly
Returns the value of attribute item.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#call(render_proc = true) ⇒ Object
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.
-
#initialize(item, options = {}) ⇒ Content
constructor
A new instance of Content.
Constructor Details
#initialize(item, options = {}) ⇒ Content
Returns a new instance of Content.
75 76 77 78 |
# File 'lib/skn_registry.rb', line 75 def initialize(item, = {}) @item = item @options = { call: item.is_a?(::Proc) }.merge() end |
Instance Attribute Details
#item ⇒ Object (readonly)
Returns the value of attribute item.
73 74 75 |
# File 'lib/skn_registry.rb', line 73 def item @item end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
73 74 75 |
# File 'lib/skn_registry.rb', line 73 def @options end |
Instance Method Details
#call(render_proc = true) ⇒ Object
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
85 86 87 88 89 90 |
# File 'lib/skn_registry.rb', line 85 def call(render_proc=true) _opts = .reject {|k,v| k === :call } _do_call = render_proc && [:call] _do_call ? (_opts.empty? ? item.call : item.call( _opts )) : item end |