class Voom::Presenters::DSL::Components::Link
Constants
- VALID_TARGETS
Attributes
target[RW]
text[RW]
url[RW]
Public Class Methods
new(parent:, **attribs_, &block)
click to toggle source
Calls superclass method
# File lib/voom/presenters/dsl/components/link.rb, line 10 def initialize(parent:, **attribs_, &block) super(type: :link, parent: parent, **attribs_, &block) @url = attribs_.delete(:url) @text = attribs_.delete(:text) { url } @target = validate_target(attribs_.delete(:target) { :self }) expand! end
Private Instance Methods
validate_target(value)
click to toggle source
# File lib/voom/presenters/dsl/components/link.rb, line 22 def validate_target(value) target = value&.to_sym unless VALID_TARGETS.include?(target) raise Errors::ParameterValidation, "target must be one of #{VALID_TARGETS.join(', ')}" end target end