Class: Comet::Slot

Inherits:
SlotBase show all
Defined in:
lib/comet-html/parser-slot.rb

Defined Under Namespace

Classes: Probe

Instance Attribute Summary collapse

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

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, #implements_ibindable_view?, #is_root?, #probe, #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) ⇒ Slot

Returns a new instance of Slot.



89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/comet-html/parser-slot.rb', line 89

def initialize el, parent
  super el, parent
  @typename   = "#{context.classes.first.typename}Slot_#{context.slot_count}"

  @slot_name = el["name"].to_s
  @slot_ref  = "slot_#{@slot_name}"
  @anchor    = find_anchorable_anchor(el)

  unless is_valid_cpp_variable_name?(@slot_name)
    raise ParseError.new(el, "slot name `#{@slot_name}` is not a valid C++ variable name")
  end

  context.slot_count += 1
end

Instance Attribute Details

#anchorObject (readonly)

Returns the value of attribute anchor.



87
88
89
# File 'lib/comet-html/parser-slot.rb', line 87

def anchor
  @anchor
end

#slot_nameObject (readonly)

Returns the value of attribute slot_name.



87
88
89
# File 'lib/comet-html/parser-slot.rb', line 87

def slot_name
  @slot_name
end

#slot_refObject (readonly)

Returns the value of attribute slot_ref.



87
88
89
# File 'lib/comet-html/parser-slot.rb', line 87

def slot_ref
  @slot_ref
end

Instance Method Details

#is_anchorable?Boolean

Returns:

  • (Boolean)


104
105
106
# File 'lib/comet-html/parser-slot.rb', line 104

def is_anchorable?
  true
end