Class: LcpRuby::ViewSlots::SlotComponent

Inherits:
Object
  • Object
show all
Defined in:
lib/lcp_ruby/view_slots/slot_component.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_callbackObject (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

#nameObject (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

#pageObject (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

#partialObject (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

#positionObject (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

#slotObject (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

Returns:

  • (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