Class: LcpRuby::ViewSlots::SlotComponent
- Inherits:
-
Object
- Object
- LcpRuby::ViewSlots::SlotComponent
- Defined in:
- lib/lcp_ruby/view_slots/slot_component.rb
Instance Attribute Summary collapse
-
#enabled_callback ⇒ Object
readonly
Returns the value of attribute enabled_callback.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#page ⇒ Object
readonly
Returns the value of attribute page.
-
#partial ⇒ Object
readonly
Returns the value of attribute partial.
-
#position ⇒ Object
readonly
Returns the value of attribute position.
-
#slot ⇒ Object
readonly
Returns the value of attribute slot.
Instance Method Summary collapse
- #enabled?(context) ⇒ Boolean
-
#initialize(page:, slot:, name:, partial:, position: 10, enabled: nil) ⇒ SlotComponent
constructor
A new instance of SlotComponent.
Constructor Details
#initialize(page:, slot:, name:, partial:, position: 10, enabled: nil) ⇒ SlotComponent
Returns a new instance of SlotComponent.
6 7 8 9 10 11 12 13 |
# File 'lib/lcp_ruby/view_slots/slot_component.rb', line 6 def initialize(page:, slot:, name:, partial:, position: 10, enabled: nil) @page = page.to_sym @slot = slot.to_sym @name = name.to_sym @partial = partial @position = position @enabled_callback = enabled end |
Instance Attribute Details
#enabled_callback ⇒ Object (readonly)
Returns the value of attribute enabled_callback.
4 5 6 |
# File 'lib/lcp_ruby/view_slots/slot_component.rb', line 4 def enabled_callback @enabled_callback end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/lcp_ruby/view_slots/slot_component.rb', line 4 def name @name end |
#page ⇒ Object (readonly)
Returns the value of attribute page.
4 5 6 |
# File 'lib/lcp_ruby/view_slots/slot_component.rb', line 4 def page @page end |
#partial ⇒ Object (readonly)
Returns the value of attribute partial.
4 5 6 |
# File 'lib/lcp_ruby/view_slots/slot_component.rb', line 4 def partial @partial end |
#position ⇒ Object (readonly)
Returns the value of attribute position.
4 5 6 |
# File 'lib/lcp_ruby/view_slots/slot_component.rb', line 4 def position @position end |
#slot ⇒ Object (readonly)
Returns the value of attribute slot.
4 5 6 |
# File 'lib/lcp_ruby/view_slots/slot_component.rb', line 4 def slot @slot end |
Instance Method Details
#enabled?(context) ⇒ Boolean
15 16 17 18 19 |
# File 'lib/lcp_ruby/view_slots/slot_component.rb', line 15 def enabled?(context) return true unless enabled_callback enabled_callback.call(context) end |