Class: CableReady::Config

Inherits:
Object
  • Object
show all
Includes:
MonitorMixin, Observable, Singleton
Defined in:
lib/cable_ready/config.rb

Overview

This class is a process level singleton shared by all threads: CableReady::Config.instance

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



14
15
16
17
# File 'lib/cable_ready/config.rb', line 14

def initialize
  super
  @operation_names = Set.new(default_operation_names)
end

Instance Method Details

#add_operation_name(name) ⇒ Object



23
24
25
26
27
28
# File 'lib/cable_ready/config.rb', line 23

def add_operation_name(name)
  synchronize do
    @operation_names << name.to_sym
    notify_observers name.to_sym
  end
end

#default_operation_namesObject



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/cable_ready/config.rb', line 30

def default_operation_names
  Set.new(i[
    add_css_class
    append
    clear_storage
    console_log
    dispatch_event
    go
    graft
    inner_html
    insert_adjacent_html
    insert_adjacent_text
    morph
    notification
    outer_html
    play_sound
    prepend
    push_state
    remove
    remove_attribute
    remove_css_class
    remove_storage_item
    replace
    replace_state
    scroll_into_view
    set_attribute
    set_cookie
    set_dataset_property
    set_focus
    set_property
    set_storage_item
    set_style
    set_styles
    set_value
    text_content
  ]).freeze
end

#operation_namesObject



19
20
21
# File 'lib/cable_ready/config.rb', line 19

def operation_names
  @operation_names.to_a
end