Method: Comet::Reference#set_mode

Defined in:
lib/comet-html/parser-reference.rb

#set_mode(mode) ⇒ Object



61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/comet-html/parser-reference.rb', line 61

def set_mode mode
  if (mode.nil? && !@el["ref"].nil?) || (mode == :explicit)
    @mode = :explicit
    @name = @el["ref"].to_s
    unless is_valid_cpp_variable_name?(@name)
      raise ParseError.new(el, "ref `#{@name}` is not a valid c++ variable name")
    end
  else
    @mode = :implicit
    @name = "element_#{@parent.context.generate_new_ref_name}"
  end
end