Class: WebIDL::Ast::ScopedName

Inherits:
Node
  • Object
show all
Defined in:
lib/webidl/ast/scoped_name.rb

Instance Attribute Summary collapse

Attributes inherited from Node

#parent

Instance Method Summary collapse

Methods inherited from Node

#accept, #snake_name

Constructor Details

#initialize(parent, name, opts = {}) ⇒ ScopedName

Returns a new instance of ScopedName.



7
8
9
10
11
12
# File 'lib/webidl/ast/scoped_name.rb', line 7

def initialize(parent, name, opts = {})
  super(parent)

  @name     = name
  @relative = !!opts[:relative]
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/webidl/ast/scoped_name.rb', line 5

def name
  @name
end

Instance Method Details

#qualified_nameObject



14
15
16
17
18
19
20
# File 'lib/webidl/ast/scoped_name.rb', line 14

def qualified_name
  if relative? && @parent
    "#{@parent.qualified_name}::#{@name}"
  else
    "::#{@name}"
  end
end

#relative?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/webidl/ast/scoped_name.rb', line 22

def relative?
  @relative
end