Sha256: 22f5cda59058bbdf01ff416bc518853216db64550ecf21f15ecb83ecf1f0f631

Contents?: true

Size: 574 Bytes

Versions: 36

Compression:

Stored size: 574 Bytes

Contents

module Steep
  module ModuleHelper
    def module_name_from_node(parent_node, constant_name)
      if namespace = namespace_from_node(parent_node)
        RBS::TypeName.new(name: constant_name, namespace: namespace)
      end
    end

    def namespace_from_node(node)
      if node
        case node.type
        when :cbase
          RBS::Namespace.root
        when :const
          if parent = namespace_from_node(node.children[0])
            parent.append(node.children[1])
          end
        end
      else
        RBS::Namespace.empty
      end
    end
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
steep-1.9.1 lib/steep/module_helper.rb
steep-1.9.0 lib/steep/module_helper.rb
steep-1.9.0.dev.2 lib/steep/module_helper.rb
steep-1.9.0.dev.1 lib/steep/module_helper.rb
steep-1.8.3 lib/steep/module_helper.rb
steep-1.8.2 lib/steep/module_helper.rb
steep-1.8.1 lib/steep/module_helper.rb
steep-1.8.0 lib/steep/module_helper.rb
steep-1.8.0.pre.2 lib/steep/module_helper.rb
steep-1.8.0.pre.1 lib/steep/module_helper.rb
steep-1.8.0.dev.2 lib/steep/module_helper.rb
steep-1.8.0.dev.1 lib/steep/module_helper.rb
steep-1.7.1 lib/steep/module_helper.rb
steep-1.7.0 lib/steep/module_helper.rb
steep-1.7.0.dev.3 lib/steep/module_helper.rb
steep-1.7.0.dev.2 lib/steep/module_helper.rb
steep-1.7.0.dev.1 lib/steep/module_helper.rb
steep-1.6.0 lib/steep/module_helper.rb
steep-1.6.0.pre.4 lib/steep/module_helper.rb
steep-1.6.0.pre.3 lib/steep/module_helper.rb