Class: WebIDL::Ast::Node
- Inherits:
-
Object
- Object
- WebIDL::Ast::Node
- Defined in:
- lib/webidl/ast/node.rb
Direct Known Subclasses
Argument, Attribute, Callback, Const, Dictionary, DictionaryMember, Enum, Exception, ExtendedAttribute, Field, ImplementsStatement, IncludesStatement, Interface, Module, Operation, PromiseType, ScopedName, Sequence, Type, TypeDef
Instance Attribute Summary collapse
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
Instance Method Summary collapse
- #accept(visitor, &blk) ⇒ Object
-
#initialize(parent = nil) ⇒ Node
constructor
A new instance of Node.
- #qualified_name ⇒ Object
- #snake_name ⇒ Object
Constructor Details
#initialize(parent = nil) ⇒ Node
Returns a new instance of Node.
7 8 9 |
# File 'lib/webidl/ast/node.rb', line 7 def initialize(parent = nil) @parent = parent end |
Instance Attribute Details
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
5 6 7 |
# File 'lib/webidl/ast/node.rb', line 5 def parent @parent end |
Instance Method Details
#accept(visitor, &blk) ⇒ Object
21 22 23 |
# File 'lib/webidl/ast/node.rb', line 21 def accept(visitor, &blk) visitor.send("visit_#{snake_name}", self, &blk) end |
#qualified_name ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/webidl/ast/node.rb', line 11 def qualified_name return unless @name if @parent.respond_to?(:qualified_name) "#{@parent.qualified_name}::#{@name}" else "::#{@name}" end end |
#snake_name ⇒ Object
25 26 27 |
# File 'lib/webidl/ast/node.rb', line 25 def snake_name self.class.name.split("::").last.snake_case end |