Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
36 changed files
with
593 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ name: dependency-review | |
on: | ||
pull_request: | ||
branches: | ||
- master | ||
- main | ||
|
||
permissions: | ||
contents: read | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,6 @@ on: | |
push: | ||
branches: | ||
- main | ||
- master | ||
paths: | ||
- .github/workflows/semgrep.yml | ||
schedule: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,8 @@ source 'https://rubygems.org' | |
|
||
gemspec | ||
|
||
gem 'rbs' | ||
gem 'steep' | ||
gem 'rubyzip' | ||
|
||
group :development do | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# D = Steep::Diagnostic | ||
# | ||
target :lib do | ||
signature 'sig' | ||
|
||
check 'lib' | ||
# check 'tasks' | ||
|
||
# check 'Gemfile' | ||
# check 'Guardfile' | ||
# check 'Rakefile' | ||
# check 'Steepfile' | ||
|
||
# library 'rubyzip' | ||
library 'yaml' | ||
library 'securerandom' | ||
# | ||
# # configure_code_diagnostics(D::Ruby.default) # `default` diagnostics setting (applies by default) | ||
# # configure_code_diagnostics(D::Ruby.strict) # `strict` diagnostics setting | ||
# # configure_code_diagnostics(D::Ruby.lenient) # `lenient` diagnostics setting | ||
# # configure_code_diagnostics(D::Ruby.silent) # `silent` diagnostics setting | ||
# # configure_code_diagnostics do |hash| # You can setup everything yourself | ||
# # hash[D::Ruby::NoMethod] = :information | ||
# # end | ||
end | ||
|
||
# target :test do | ||
# signature 'sig', 'sig-private' | ||
# | ||
# check 'test' | ||
# | ||
# # library 'pathname' # Standard libraries | ||
# end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
module Rambling | ||
module Trie | ||
VERSION: String | ||
|
||
@properties: Configuration::Properties | ||
|
||
def self.create: (String?, Readers::Reader?) ?{ (Container) -> void } -> Container | ||
|
||
def self.load: (String, Serializers::Serializer[Nodes::Node]?) ?{ (Container) -> void } -> Container | ||
|
||
def self.dump: (Container, String, Serializers::Serializer[Nodes::Node]?) -> void | ||
|
||
def self.config: ?{ (Configuration::Properties) -> void } -> Configuration::Properties | ||
|
||
private | ||
|
||
def self.properties: -> Configuration::Properties | ||
|
||
def self.readers: -> Configuration::ProviderCollection[Readers::Reader] | ||
|
||
def self.serializers: -> Configuration::ProviderCollection[Serializers::Serializer[Nodes::Node]] | ||
|
||
def self.compressor: -> Compressor | ||
|
||
def self.root_builder: -> ^() -> Nodes::Node | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
module Rambling | ||
module Trie | ||
module Comparable | ||
def ==: (Nodes::Node) -> bool | ||
|
||
private | ||
|
||
# abstract methods | ||
|
||
def letter: -> Symbol | ||
|
||
def terminal?: -> bool | ||
|
||
def children_tree: -> Hash[Symbol, Nodes::Node] | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
module Rambling | ||
module Trie | ||
module Compressible | ||
def compressible?: -> bool | ||
|
||
private | ||
|
||
# abstract methods | ||
|
||
def root?: -> bool | ||
|
||
def terminal?: -> bool | ||
|
||
def children_tree: -> Hash[Symbol, Nodes::Node] | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
module Rambling | ||
module Trie | ||
class Compressor | ||
def compress: (Nodes::Node?) -> Nodes::Compressed? | ||
|
||
private | ||
|
||
def compress_child_and_merge: (Nodes::Node) -> Nodes::Compressed | ||
|
||
def merge: (Nodes::Node, Nodes::Node?) -> Nodes::Compressed | ||
|
||
def compress_children_and_copy: (Nodes::Node) -> Nodes::Compressed | ||
|
||
def compress_children: (Hash[Symbol, Nodes::Node]) -> Hash[Symbol, Nodes::Node] | ||
|
||
def new_compressed_node: (Symbol?, Nodes::Node?, Hash[Symbol, Nodes::Node], bool?) -> Nodes::Compressed | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
module Rambling | ||
module Trie | ||
module Configuration | ||
class Properties | ||
attr_reader readers: ProviderCollection[Readers::Reader] | ||
attr_reader serializers: ProviderCollection[Serializers::Serializer[Nodes::Node]] | ||
attr_accessor compressor: Compressor | ||
attr_accessor root_builder: ^() -> Nodes::Node | ||
attr_accessor tmp_path: String | ||
|
||
def initialize: -> void | ||
|
||
def reset: -> void | ||
|
||
private | ||
|
||
attr_writer readers: ProviderCollection[Readers::Reader] | ||
attr_writer serializers: ProviderCollection[Serializers::Serializer[Nodes::Node]] | ||
|
||
def reset_readers: -> void | ||
|
||
def default_reader_providers: -> Hash[Symbol, Readers::Reader] | ||
|
||
def reset_serializers: -> void | ||
end | ||
end | ||
end | ||
end |
47 changes: 47 additions & 0 deletions
47
sig/lib/rambling/trie/configuration/provider_collection.rbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
module Rambling | ||
module Trie | ||
module Configuration | ||
class ProviderCollection[TProvider < _Nilable] | ||
interface _Nilable | ||
def nil?: -> bool | ||
end | ||
|
||
@providers: Hash[Symbol, TProvider] | ||
|
||
attr_reader name: Symbol | ||
attr_reader default: TProvider? | ||
|
||
def initialize: (Symbol, Hash[Symbol, TProvider], ?TProvider?) -> void | ||
|
||
def []: (Symbol) -> TProvider | ||
|
||
def add: (Symbol, TProvider) -> TProvider | ||
|
||
def default=: (TProvider?) -> TProvider? | ||
|
||
def formats: -> Array[Symbol] | ||
|
||
def providers: -> Hash[Symbol, TProvider] | ||
|
||
def reset: -> void | ||
|
||
def resolve: (String) -> TProvider? | ||
|
||
private | ||
|
||
attr_reader configured_default: TProvider? | ||
attr_reader configured_providers: Hash[Symbol, TProvider] | ||
|
||
def []=: (Symbol, TProvider) -> TProvider | ||
|
||
def values: -> Array[TProvider] | ||
|
||
def file_format: (String) -> Symbol | ||
|
||
def contains?: (TProvider?) -> bool | ||
|
||
alias provider_instances values | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.