Class: Comet::SlotPlugin
- Defined in:
- lib/comet-html/parser-slot.rb
Instance Attribute Summary collapse
-
#on_element ⇒ Object
readonly
Returns the value of attribute on_element.
-
#slot_name ⇒ Object
readonly
Returns the value of attribute slot_name.
Attributes inherited from Class
#anchor_name, #bindings, #children, #el, #event_listeners, #inline_code, #parent, #refs, #repeaters, #slot_plugins, #slots, #superclass, #typename
Instance Method Summary collapse
- #constructor_params ⇒ Object
- #has_ref? ⇒ Boolean
- #implements_ibindable_view? ⇒ Boolean
-
#initialize(el, parent, on_element) ⇒ SlotPlugin
constructor
A new instance of SlotPlugin.
- #is_custom_element? ⇒ Boolean
- #probe ⇒ Object
Methods inherited from SlotBase
#create_reference, #find_remote_reference_holder
Methods inherited from Class
#blocks_remote_references?, #collect_children, #constructor_decl, #create_reference, #find_class_for, #find_reference_for, #is_anchorable?, #is_root?, #probe_bindings, #probe_bindings_for, #probe_references, #probe_slots_plugins, #probe_subtypes, #recursively_collect_children, #root, #should_skip?
Methods inherited from Context
#context, element_base_type, find_cpp_type, generate_new_ref_name, has_cpp_type?, load_global_element_types, reset, template_base_subtype, template_base_type, use_cpp_type
Constructor Details
#initialize(el, parent, on_element) ⇒ SlotPlugin
Returns a new instance of SlotPlugin.
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/comet-html/parser-slot.rb', line 36 def initialize el, parent, on_element super el, parent @slot_name = el["slot"].to_s @on_element = on_element @typename = "#{context.classes.first.typename}SlotPlugin_#{context.slot_count}" @superclass = context.find_cpp_type el.name, fallback: context.template_base_subtype context.use_cpp_type el.name if is_custom_element? context.slot_count += 1 if has_ref? ref_root = find_remote_reference_holder if ref_root.nil? puts "[comet-html] ignoring ref at #{context.filename}:#{el.line}" el["ref"] = nil else @parent = ref_root ref = CppReference.new el, @typename, el["ref"] ref.initializer = constructor_params ref.setter_enabled = false ref_root.refs << ref end end end |
Instance Attribute Details
#on_element ⇒ Object (readonly)
Returns the value of attribute on_element.
26 27 28 |
# File 'lib/comet-html/parser-slot.rb', line 26 def on_element @on_element end |
#slot_name ⇒ Object (readonly)
Returns the value of attribute slot_name.
26 27 28 |
# File 'lib/comet-html/parser-slot.rb', line 26 def slot_name @slot_name end |
Instance Method Details
#constructor_params ⇒ Object
60 61 62 |
# File 'lib/comet-html/parser-slot.rb', line 60 def constructor_params "this" end |
#has_ref? ⇒ Boolean
64 65 66 |
# File 'lib/comet-html/parser-slot.rb', line 64 def has_ref? not el["ref"].nil? end |
#implements_ibindable_view? ⇒ Boolean
28 29 30 |
# File 'lib/comet-html/parser-slot.rb', line 28 def implements_ibindable_view? is_custom_element? end |
#is_custom_element? ⇒ Boolean
32 33 34 |
# File 'lib/comet-html/parser-slot.rb', line 32 def is_custom_element? context.has_cpp_type? el end |
#probe ⇒ Object
68 69 70 71 |
# File 'lib/comet-html/parser-slot.rb', line 68 def probe super probe_bindings_for el end |