Class: Voom::Presenters::DSL::Components::Actions::Base

Inherits:
Base
  • Object
show all
Defined in:
lib/voom/presenters/dsl/components/actions/base.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#attributes, #css_class, #draggable, #drop_zone, #id, #tag, #type

Instance Method Summary collapse

Methods inherited from Base

#expand!

Methods included from Pluggable

#include_plugins, #plugin, #plugin_module

Methods included from Mixins::YieldTo

#yield_to

Methods included from Serializer

#to_hash

Methods included from Lockable

#locked?

Constructor Details

#initialize(type:, **attribs_, &block) ⇒ Base

Returns a new instance of Base.



11
12
13
14
15
16
17
18
19
# File 'lib/voom/presenters/dsl/components/actions/base.rb', line 11

def initialize(type:, **attribs_, &block)
  super(type: type, **attribs_, &block)
  @options = {}
  extract_options!
  _params_ = attribs.delete(:params) {{}}
  @dynamic_params = extract_dynamic_params(_params_)
  @params = extract_params(_params_)
  @url = nil
end

Instance Attribute Details

#dynamic_paramsObject (readonly)

Options are used by the actions Params are passed by the user



9
10
11
# File 'lib/voom/presenters/dsl/components/actions/base.rb', line 9

def dynamic_params
  @dynamic_params
end

#optionsObject (readonly)

Options are used by the actions Params are passed by the user



9
10
11
# File 'lib/voom/presenters/dsl/components/actions/base.rb', line 9

def options
  @options
end

#paramsObject (readonly)

Options are used by the actions Params are passed by the user



9
10
11
# File 'lib/voom/presenters/dsl/components/actions/base.rb', line 9

def params
  @params
end

Instance Method Details

#urlObject



21
22
23
# File 'lib/voom/presenters/dsl/components/actions/base.rb', line 21

def url
  @parent.router.url(render: options[:presenter], command: options[:path], context: params)
end