Sha256: 6a06c3c89b53f7e4b448d9d0b11c783519894ad13604a38fbe2e5d2b7ba8942d
Contents?: true
Size: 927 Bytes
Versions: 14
Compression:
Stored size: 927 Bytes
Contents
require_relative 'base' module Voom module Presenters module DSL module Components class Action < Base # Options are used by the actions # Params are passed by the user attr_reader :params, :options def initialize(type:, **attribs_, &block) super(type: type, **attribs_, &block) @options = {} extract_options! @params = attribs.delete(:params) {{}} @url = nil end def url @parent.router.url(render: options[:presenter], command: options[:path], context: params) end private def extract_options! %i(path presenter target).each do |option| optionValue = attribs.delete(option) @options.merge!({option => optionValue}) if optionValue end end end end end end end
Version data entries
14 entries across 14 versions & 1 rubygems