Skip to content

Commit

Permalink
Update yard (#440)
Browse files Browse the repository at this point in the history
* Update library

* Update yard-generator for new version

* Generate yard from orthoses-yard v0.6.0

- Update yard
- Fix type reference
- Fix documentation
- Add more types

* Reduce files with namespace depth = 2
  • Loading branch information
ksss authored Oct 23, 2023
1 parent c729dfd commit db9cd3f
Show file tree
Hide file tree
Showing 271 changed files with 9,896 additions and 8,678 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
tmp
.gem_rbs_collection
.yardoc
4 changes: 0 additions & 4 deletions gems/yard/0.9/EXTERNAL_TODO.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,11 @@
class OpenStruct
end

class Ripper
end

module Rake
class TaskLib
end
end


module WEBrick
module HTTPServlet
class AbstractServlet
Expand Down
2 changes: 1 addition & 1 deletion gems/yard/0.9/_scripts/test
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ RBS_DIR=$(cd $(dirname $0)/..; pwd)
# Set REPO_DIR variable to validate RBS files added to the corresponding folder
REPO_DIR=$(cd $(dirname $0)/../../..; pwd)
# Validate RBS files, using the bundler environment present
bundle exec rbs --repo $REPO_DIR -r yard:0.9 -r uri -r cgi -r optparse -r logger -r monitor -r set -r rack:2.2 validate --silent
bundle exec rbs --repo $REPO_DIR -r yard:0.9 -r optparse -r logger -r ripper validate --silent

cd ${RBS_DIR}/_test
# Run type checks
Expand Down
6 changes: 1 addition & 5 deletions gems/yard/0.9/_test/Steepfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,11 @@ target :test do

repo_path "../../../"

library "uri"
library "cgi"
library "optparse"
library "logger"
library "monitor"
library "set"
library "ripper"

library "yard:0.9"
library "rack:2.2"

configure_code_diagnostics(D::Ruby.all_error)
end
25 changes: 25 additions & 0 deletions gems/yard/0.9/_test/yard.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,28 @@
child.name(false)
child.docstring.all
end

::YARD::DocstringParser.new.parse("@option a b [String]").tags.each do |tag|
case tag
when YARD::Tags::OverloadTag
tag.types
when YARD::Tags::OptionTag
tag.pair.defaults
when YARD::Tags::Tag
tag.name
end
end

types_explainers = ::YARD::Tags::TypesExplainer::Parser.parse("Hash{Symbol => String}")
types_explainers.each do |types_explainer|
case types_explainer
when YARD::Tags::TypesExplainer::HashCollectionType
types_explainer.key_types.each { }
when YARD::Tags::TypesExplainer::FixedCollectionType
types_explainer.types.each { }
when YARD::Tags::TypesExplainer::CollectionType
types_explainer.types.each { }
else
types_explainer.name
end
end
4 changes: 1 addition & 3 deletions gems/yard/0.9/manifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
# Please see generators/yard-generator/README.md

dependencies:
- name: uri
- name: cgi
- name: optparse
- name: logger
- name: monitor
- name: ripper
21 changes: 16 additions & 5 deletions gems/yard/0.9/symbol_hash.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# A subclass of Hash where all keys are converted into Symbols, and
# optionally, all String values are converted into Symbols.
class SymbolHash < ::Hash[untyped, untyped]
class SymbolHash[unchecked out K, unchecked out V] < ::Hash[untyped, untyped]
# Creates a new SymbolHash object
#
# @param [Boolean] symbolize_value converts any String values into Symbols
Expand Down Expand Up @@ -42,17 +42,28 @@ class SymbolHash < ::Hash[untyped, untyped]
# @param [#to_sym] key the key to test
# @return [Boolean] whether the key exists
def key?: (untyped key) -> bool
alias has_key? key?
# Tests if a symbolized key exists
# @param [#to_sym] key
# the key to test
# @return [Boolean] whether the key exists
#
def has_key?: (untyped key) -> bool
# Updates the object with the contents of another Hash object.
# This method modifies the original SymbolHash object
#
# @param [Hash] hash the hash object to copy the values from
# @return [SymbolHash] self
def update: (Hash[untyped, untyped] hash) -> SymbolHash
alias merge! update
def update: (Hash[untyped, untyped] hash) -> SymbolHash[K, V]
# Updates the object with the contents of another Hash object.
# This method modifies the original SymbolHash object
# @param [Hash] hash
# the hash object to copy the values from
# @return [SymbolHash] self
#
def merge!: (Hash[untyped, untyped] hash) -> SymbolHash[K, V]
# Merges the contents of another hash into a new SymbolHash object
#
# @param [Hash] hash the hash of objects to copy
# @return [SymbolHash] a new SymbolHash containing the merged data
def merge: (Hash[untyped, untyped] hash) -> SymbolHash
def merge: (Hash[untyped, untyped] hash) -> SymbolHash[K, V]
end
Loading

0 comments on commit db9cd3f

Please sign in to comment.