Class: Super::Partial
- Inherits:
-
Object
- Object
- Super::Partial
- Defined in:
- lib/super/partial.rb,
lib/super/partial/resolving.rb
Defined Under Namespace
Modules: Resolving
Instance Attribute Summary collapse
-
#locals ⇒ Object
readonly
Returns the value of attribute locals.
-
#to_partial_path ⇒ Object
readonly
Returns the value of attribute to_partial_path.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(path, locals: {}) ⇒ Partial
constructor
A new instance of Partial.
Constructor Details
#initialize(path, locals: {}) ⇒ Partial
Returns a new instance of Partial.
17 18 19 20 |
# File 'lib/super/partial.rb', line 17 def initialize(path, locals: {}) @to_partial_path = path @locals = locals end |
Instance Attribute Details
#locals ⇒ Object (readonly)
Returns the value of attribute locals.
23 24 25 |
# File 'lib/super/partial.rb', line 23 def locals @locals end |
#to_partial_path ⇒ Object (readonly)
Returns the value of attribute to_partial_path.
22 23 24 |
# File 'lib/super/partial.rb', line 22 def to_partial_path @to_partial_path end |
Class Method Details
.render(partialish, template:) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/super/partial.rb', line 5 def self.render(partialish, template:) if partialish.respond_to?(:to_partial_path) if partialish.respond_to?(:locals) template.render(partialish, partialish.locals) else template.render(partialish) end else partialish end end |