Module: Card::Set::Abstract::AssetInputter
- Extended by:
- Card::Set
- Defined in:
- platypus/tmp/set/gem-defaults/mod018-assets/abstract/asset_inputter.rb
Overview
Set: Abstract (AssetInputter)
Defined Under Namespace
Modules: HtmlFormat
Constant Summary
Constants included
from Helpers
Helpers::SET_PATTERN_TEST_REGEXP
Constants included
from Event::Api
Event::Api::OPTIONS
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Card::Set
reset
Methods included from I18nScope
#mod_name, #scope
Methods included from Registrar
#extended, #finalize_load, #process_base_modules, #register_set
Methods included from Helpers
#format_module, #format_modules, #method_missing, #modules, #pattern_code, #respond_to_missing?, #set_name_parts, #shortname, #underscored_name
#assign_type, #attachment, #define_set_from_error, #ensure_set, #setting_opts, #stage_method
Methods included from Format
#before, #format, layout_method_name, #view, view_method_name, view_setting_method_name, wrapper_method_name
#include_set, #include_set_formats
Methods included from Trait
#card_accessor, #card_reader, #card_writer, #require_field
Methods included from Event::Api
#event
Class Method Details
.source_location ⇒ Object
[View source]
7
|
# File 'platypus/tmp/set/gem-defaults/mod018-assets/abstract/asset_inputter.rb', line 7
def self.source_location; "/Users/ethan/dev/decko/gem/mod/assets/set/abstract/asset_inputter.rb"; end
|
Instance Method Details
#assemble_asset_input_content ⇒ Object
[View source]
56
57
58
|
# File 'platypus/tmp/set/gem-defaults/mod018-assets/abstract/asset_inputter.rb', line 56
def assemble_asset_input_content
format(input_format).render input_view
end
|
#asset_input_content ⇒ Object
[View source]
50
51
52
53
54
|
# File 'platypus/tmp/set/gem-defaults/mod018-assets/abstract/asset_inputter.rb', line 50
def asset_input_content
return assemble_asset_input_content if virtual?
update_asset_input if asset_input.blank?
asset_input
end
|
[View source]
72
73
74
|
# File 'platypus/tmp/set/gem-defaults/mod018-assets/abstract/asset_inputter.rb', line 72
def asset_input_needs_refresh?
false
end
|
[View source]
64
65
66
|
# File 'platypus/tmp/set/gem-defaults/mod018-assets/abstract/asset_inputter.rb', line 64
def asset_input_updated_at
asset_input_card&.updated_at
end
|
[View source]
77
78
79
|
# File 'platypus/tmp/set/gem-defaults/mod018-assets/abstract/asset_inputter.rb', line 77
def asset_inputter?
true
end
|
[View source]
10
11
12
|
# File 'platypus/tmp/set/gem-defaults/mod018-assets/abstract/asset_inputter.rb', line 10
def dependent_asset_inputters
referers_responding_to :asset_input
end
|
[View source]
22
23
24
25
|
# File 'platypus/tmp/set/gem-defaults/mod018-assets/abstract/asset_inputter.rb', line 22
event :asset_input_changed, :finalize,
on: :save, when: :asset_inputter?, changed: :content, skip: :allowed do
update_asset_input
end
|
[View source]
27
28
29
30
|
# File 'platypus/tmp/set/gem-defaults/mod018-assets/abstract/asset_inputter.rb', line 27
event :asset_input_changed_on_delete, :finalize,
on: :delete, when: :asset_inputter?, before: :clear_references do
update_referers_after_input_changed
end
|
[View source]
60
61
62
|
# File 'platypus/tmp/set/gem-defaults/mod018-assets/abstract/asset_inputter.rb', line 60
def input_view
:core
end
|
#outputters ⇒ Object
[View source]
14
15
16
|
# File 'platypus/tmp/set/gem-defaults/mod018-assets/abstract/asset_inputter.rb', line 14
def outputters
referers_responding_to :update_asset_output
end
|
#referers_responding_to(method_name) ⇒ Object
[View source]
18
19
20
|
# File 'platypus/tmp/set/gem-defaults/mod018-assets/abstract/asset_inputter.rb', line 18
def referers_responding_to method_name
referers.select { |referer| referer.respond_to? method_name }
end
|
#refresh_asset ⇒ Object
[View source]
68
69
70
|
# File 'platypus/tmp/set/gem-defaults/mod018-assets/abstract/asset_inputter.rb', line 68
def refresh_asset
update_asset_input if asset_input_needs_refresh?
end
|
[View source]
40
41
42
43
44
45
46
47
48
|
# File 'platypus/tmp/set/gem-defaults/mod018-assets/abstract/asset_inputter.rb', line 40
def update_asset_input
return unless Codename.exist? :asset_input
Card::Auth.as_bot do
asset_input_card.update({})
update_referers_after_input_changed
end
end
|
[View source]
32
33
34
35
36
37
38
|
# File 'platypus/tmp/set/gem-defaults/mod018-assets/abstract/asset_inputter.rb', line 32
def update_referers_after_input_changed
dependent_asset_inputters.each(&:update_asset_input)
outputters.each(&:update_asset_output)
end
|