Class: Glib::JsonUi::ActionBuilder

Inherits:
AbstractBuilder show all
Defined in:
app/helpers/glib/json_ui/action_builder/bottom_banners.rb,
app/helpers/glib/json_ui/action_builder.rb,
app/helpers/glib/json_ui/action_builder/iap.rb,
app/helpers/glib/json_ui/action_builder/http.rb,
app/helpers/glib/json_ui/action_builder/files.rb,
app/helpers/glib/json_ui/action_builder/tours.rb,
app/helpers/glib/json_ui/action_builder/fields.rb,
app/helpers/glib/json_ui/action_builder/logics.rb,
app/helpers/glib/json_ui/action_builder/panels.rb,
app/helpers/glib/json_ui/action_builder/sheets.rb,
app/helpers/glib/json_ui/action_builder/dialogs.rb,
app/helpers/glib/json_ui/action_builder/windows.rb,
app/helpers/glib/json_ui/action_builder/browsers.rb,
app/helpers/glib/json_ui/action_builder/commands.rb,
app/helpers/glib/json_ui/action_builder/popovers.rb,
app/helpers/glib/json_ui/action_builder/snackbars.rb,
app/helpers/glib/json_ui/action_builder/components.rb,
app/helpers/glib/json_ui/action_builder/global_states.rb,
app/helpers/glib/json_ui/action_builder/storage_items.rb

Overview

deprecated

Defined Under Namespace

Modules: Analytics, Auth, BottomBanners, Browsers, Cables, Commands, Components, Cookies, Devices, Dialogs, Fields, Files, Forms, GlobalStates, Http, Iap, Labels, Lists, Logics, Panels, Popovers, Sheets, Snackbars, StorageItems, Timeouts, Tours, Windows Classes: Action, RunMultiple

Instance Attribute Summary collapse

Attributes inherited from AbstractBuilder

#json, #page

Instance Method Summary collapse

Constructor Details

#initialize(json, page, multiple) ⇒ ActionBuilder

Returns a new instance of ActionBuilder.



4
5
6
7
8
# File 'app/helpers/glib/json_ui/action_builder.rb', line 4

def initialize(json, page, multiple)
  super(json, page)

  @multiple = multiple
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, *args) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'app/helpers/glib/json_ui/action_builder.rb', line 22

def method_missing(m, *args)
  if @multiple
    add_element_to_array_v1 'action', m, *args
  else
    if !Rails.env.production? && @singleton_action_set
      raise "Multiple actions called on a singleton ActionBuilder. " \
            "Only one action is allowed. Previous action: '#{@singleton_action_name}', " \
            "current action: '#{m}'. Use `run_multiple` with `childActions` or " \
            "chain actions using `onClose` callbacks."
    end
    @singleton_action_set = true
    @singleton_action_name = m
    add_singleton_element_v1 'action', m, *args
  end
end

Instance Attribute Details

#singleton_action_nameObject (readonly)

Returns the value of attribute singleton_action_name.



10
11
12
# File 'app/helpers/glib/json_ui/action_builder.rb', line 10

def singleton_action_name
  @singleton_action_name
end

#singleton_action_setObject (readonly)

Returns the value of attribute singleton_action_set.



10
11
12
# File 'app/helpers/glib/json_ui/action_builder.rb', line 10

def singleton_action_set
  @singleton_action_set
end

Instance Method Details

#reset_singleton_tracking!Object



12
13
14
15
# File 'app/helpers/glib/json_ui/action_builder.rb', line 12

def reset_singleton_tracking!
  @singleton_action_set = false
  @singleton_action_name = nil
end

#restore_singleton_tracking!(action_set, action_name) ⇒ Object



17
18
19
20
# File 'app/helpers/glib/json_ui/action_builder.rb', line 17

def restore_singleton_tracking!(action_set, action_name)
  @singleton_action_set = action_set
  @singleton_action_name = action_name
end