陡峭:Ruby的静态类型检查器

时间:2021-02-02 03:52:22
【文件属性】:
文件名称:陡峭:Ruby的静态类型检查器
文件大小:955KB
文件格式:ZIP
更新时间:2021-02-02 03:52:22
ruby typechecker RubyRuby 陡峭-Ruby的渐进式打字 安装 通过RubyGems安装。 $ gem install steep 要求 陡峭需要Ruby 2.6。 用法 Steep不会从Ruby程序中推断类型,但是需要声明类型并编写注释。 您必须执行以下三个步骤。 0. steep init 运行steep init以生成配置文件。 $ steep init # Generates Steepfile 编辑Steepfile : target :app do check "lib" signature "sig" library "set" , "pathname" end 1.声明类型 在sig目录中声明.rbs文件的类型。 class Person @name: String @contacts: Array[Email | Phone] def initialize: (name: String) -> untyped def name: -> String def contacts: -> Array[Email | Phone] def gues

网友评论