Sha256: bc253274c9b7d6deba44bbe78288dacaa2403ac33e637bcd25f1daac57d5d762

Contents?: true

Size: 573 Bytes

Versions: 8

Compression:

Stored size: 573 Bytes

Contents

module WebIDL
  module Ast
    class Node

      attr_reader :parent

      def initialize(parent = nil)
        @parent = parent
      end

      def qualified_name
        return unless @name

        if @parent.respond_to?(:qualified_name)
          "#{@parent.qualified_name}::#{@name}"
        else
          "::#{@name}"
        end
      end

      def accept(visitor, &blk)
        visitor.send("visit_#{snake_name}", self, &blk)
      end

      def snake_name
        self.class.name.split("::").last.snake_case
      end

    end # Node
  end # Ast
end # WebIDL

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
webidl-0.2.2 lib/webidl/ast/node.rb
webidl-0.2.1 lib/webidl/ast/node.rb
webidl-0.1.10 lib/webidl/ast/node.rb
webidl-0.2.0 lib/webidl/ast/node.rb
webidl-0.1.9 lib/webidl/ast/node.rb
webidl-0.1.8 lib/webidl/ast/node.rb
webidl-0.1.7 lib/webidl/ast/node.rb
webidl-0.1.6 lib/webidl/ast/node.rb