Skip to content

Commit

Permalink
Merge pull request #114 from YutaGoto/update-rbs-type
Browse files Browse the repository at this point in the history
🏷️ update types
  • Loading branch information
YutaGoto authored Feb 16, 2024
2 parents 6d899ac + b231986 commit 2999fc7
Show file tree
Hide file tree
Showing 12 changed files with 152 additions and 65 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ PATH
remote: .
specs:
ika3 (0.8.1)
activesupport (>= 5.0.0)
activesupport (>= 6.0.0)
faraday (>= 2.7.0)

GEM
Expand Down
7 changes: 7 additions & 0 deletions Steepfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
# frozen_string_literal: true

D = Steep::Diagnostic

target :lib do
signature 'sig'

check 'lib'
repo_path '.gem_rbs_collection'

configure_code_diagnostics do |hash|
hash[D::Ruby::MethodDefinitionMissing] = :warning
hash[D::Ruby::UnknownConstant] = :information
end
end
2 changes: 1 addition & 1 deletion ika3.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
spec.require_paths = ['lib']

spec.add_dependency 'activesupport', '>= 5.0.0'
spec.add_dependency 'activesupport', '>= 6.0.0'
spec.add_dependency 'faraday', '>= 2.7.0'

# For more information and examples about making a new gem, check out our
Expand Down
9 changes: 5 additions & 4 deletions lib/ika3/schedule.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# frozen_string_literal: true

class Hash
def respond_to_missing?(sym)
key? name ? true : super
def respond_to_missing?(name)
key?(name) ? true : super
end

def method_missing(name)
return self[name] if key? name
each do |key, value|
return value if key&.to_sym == name
end

each { |k, v| return v if k.to_s.to_sym == name }
super.method_missing(name)
end
end
Expand Down
10 changes: 0 additions & 10 deletions lib/ika3/weapons.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,6 @@

module Ika3
class Weapon
ATTRIBUTES = %i[
name sub special
].freeze

ATTRIBUTES.each do |attribute|
define_method attribute do
self[attribute]
end
end

class << self
include Ika3::Concerns::Utils

Expand Down
119 changes: 83 additions & 36 deletions rbs_collection.lock.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
---
sources:
- name: ruby/gem_rbs_collection
remote: https://github.com/ruby/gem_rbs_collection.git
revision: main
repo_dir: gems
path: ".gem_rbs_collection"
gems:
- name: activesupport
version: '7.0'
source:
type: git
name: ruby/gem_rbs_collection
revision: c42c09528dd99252db98f0744181a6de54ec2f55
revision: 846c09971455f0e144cef2f5a6c9fe6d8905d3e1
remote: https://github.com/ruby/gem_rbs_collection.git
repo_dir: gems
- name: ast
Expand All @@ -22,15 +17,35 @@ gems:
revision: c42c09528dd99252db98f0744181a6de54ec2f55
remote: https://github.com/ruby/gem_rbs_collection.git
repo_dir: gems
- name: base64
version: '0'
source:
type: stdlib
- name: bigdecimal
version: '0'
source:
type: stdlib
- name: concurrent-ruby
version: '1.1'
source:
type: git
name: ruby/gem_rbs_collection
revision: c42c09528dd99252db98f0744181a6de54ec2f55
revision: 846c09971455f0e144cef2f5a6c9fe6d8905d3e1
remote: https://github.com/ruby/gem_rbs_collection.git
repo_dir: gems
- name: csv
- name: connection_pool
version: '2.4'
source:
type: git
name: ruby/gem_rbs_collection
revision: 846c09971455f0e144cef2f5a6c9fe6d8905d3e1
remote: https://github.com/ruby/gem_rbs_collection.git
repo_dir: gems
- name: date
version: '0'
source:
type: stdlib
- name: erb
version: '0'
source:
type: stdlib
Expand All @@ -39,33 +54,29 @@ gems:
source:
type: git
name: ruby/gem_rbs_collection
revision: c42c09528dd99252db98f0744181a6de54ec2f55
revision: 846c09971455f0e144cef2f5a6c9fe6d8905d3e1
remote: https://github.com/ruby/gem_rbs_collection.git
repo_dir: gems
- name: fileutils
version: '0'
source:
type: stdlib
- name: forwardable
version: '0'
source:
type: stdlib
- name: i18n
version: '1.10'
source:
type: git
name: ruby/gem_rbs_collection
revision: c42c09528dd99252db98f0744181a6de54ec2f55
revision: 846c09971455f0e144cef2f5a6c9fe6d8905d3e1
remote: https://github.com/ruby/gem_rbs_collection.git
repo_dir: gems
- name: json
version: '0'
source:
type: stdlib
- name: listen
version: '3.2'
source:
type: git
name: ruby/gem_rbs_collection
revision: c42c09528dd99252db98f0744181a6de54ec2f55
remote: https://github.com/ruby/gem_rbs_collection.git
repo_dir: gems
- name: logger
version: '0'
source:
Expand All @@ -74,6 +85,22 @@ gems:
version: '0'
source:
type: stdlib
- name: monitor
version: '0'
source:
type: stdlib
- name: mutex_m
version: '0'
source:
type: stdlib
- name: net-http
version: '0'
source:
type: stdlib
- name: net-protocol
version: '0'
source:
type: stdlib
- name: parallel
version: '1.20'
source:
Expand All @@ -82,6 +109,14 @@ gems:
revision: c42c09528dd99252db98f0744181a6de54ec2f55
remote: https://github.com/ruby/gem_rbs_collection.git
repo_dir: gems
- name: parser
version: '3.2'
source:
type: git
name: ruby/gem_rbs_collection
revision: 846c09971455f0e144cef2f5a6c9fe6d8905d3e1
remote: https://github.com/ruby/gem_rbs_collection.git
repo_dir: gems
- name: rainbow
version: '3.0'
source:
Expand All @@ -90,27 +125,39 @@ gems:
revision: c42c09528dd99252db98f0744181a6de54ec2f55
remote: https://github.com/ruby/gem_rbs_collection.git
repo_dir: gems
- name: securerandom
version: '0'
source:
type: stdlib
- name: steep
version: 1.3.0
- name: rake
version: '13.0'
source:
type: rubygems
- name: strscan
version: '0'
type: git
name: ruby/gem_rbs_collection
revision: 846c09971455f0e144cef2f5a6c9fe6d8905d3e1
remote: https://github.com/ruby/gem_rbs_collection.git
repo_dir: gems
- name: regexp_parser
version: '2.8'
source:
type: stdlib
- name: date
version: '0'
type: git
name: ruby/gem_rbs_collection
revision: 846c09971455f0e144cef2f5a6c9fe6d8905d3e1
remote: https://github.com/ruby/gem_rbs_collection.git
repo_dir: gems
- name: rubocop
version: '1.57'
source:
type: stdlib
- name: monitor
version: '0'
type: git
name: ruby/gem_rbs_collection
revision: 846c09971455f0e144cef2f5a6c9fe6d8905d3e1
remote: https://github.com/ruby/gem_rbs_collection.git
repo_dir: gems
- name: rubocop-ast
version: '1.30'
source:
type: stdlib
- name: mutex_m
type: git
name: ruby/gem_rbs_collection
revision: 846c09971455f0e144cef2f5a6c9fe6d8905d3e1
remote: https://github.com/ruby/gem_rbs_collection.git
repo_dir: gems
- name: securerandom
version: '0'
source:
type: stdlib
Expand All @@ -122,7 +169,7 @@ gems:
version: '0'
source:
type: stdlib
- name: forwardable
- name: timeout
version: '0'
source:
type: stdlib
Expand Down
2 changes: 2 additions & 0 deletions rbs_collection.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ gems:
# It's unnecessary if you don't use rbs as a library.
- name: rbs
ignore: true
- name: steep
ignore: true
2 changes: 1 addition & 1 deletion sig/ika3/concerns/utils.rbs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module Ika3
module Concerns
module Utils
def self?.load_yaml_file: (file: String) -> Object
def self?.load_yaml_file: (String) -> untyped
end
end
end
21 changes: 21 additions & 0 deletions sig/ika3/response.rbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# frozen_string_literal: true

module Ika3
class Response
@raw_body: untyped

@raw_headers: untyped

@raw_status: untyped

@headers: untyped

def initialize: (untyped faraday_response) -> void

def body: () -> untyped

def headers: () -> untyped

def status: () -> untyped
end
end
14 changes: 10 additions & 4 deletions sig/ika3/schedule.rbs
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
class Hash[unchecked out K, unchecked out V] < Object
def method_missing: (name: String) -> untyped
class ::Hash[unchecked out K, unchecked out V]
def respond_to_missing?: (untyped name) -> untyped

def method_missing: (::Symbol) -> untyped
end

module Ika3
class Schedule
def initialize: (contact: String) -> void
@contact: String

@splat3_connection: untyped

def initialize: (String) -> void

private

def send_request: (method: String, path: String) -> Object
def send_request: (Symbol, String) -> untyped

def api_url: () -> "https://spla3.yuu26.com/"

Expand Down
5 changes: 5 additions & 0 deletions sig/ika3/version.rbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# frozen_string_literal: true

module Ika3
VERSION: String
end
24 changes: 16 additions & 8 deletions sig/ika3/weapon.rbs
Original file line number Diff line number Diff line change
@@ -1,24 +1,32 @@
module Ika3
class Weapon
ATTRIBUTES: ::Array[:name | :sub | :special]
self.@cache: untyped

include Ika3::Concerns::Utils
self.@config: untyped

def self.find: (untyped weapon_key) -> untyped
self.@sub_weapons: untyped

def self.find_by_name: (untyped weapon_name) -> untyped
self.@weapon_hash: untyped

def self.filter_by_sub: (untyped sub_name) -> untyped
self.@sub_weapon_hash: untyped

def self.reload_config!: () -> untyped
extend Ika3::Concerns::Utils

def self.find: (String) -> (Exception | untyped)

def self.find_by_name: (String) -> (Exception | Object)

def self.filter_by_sub: (String) -> (Exception | Object)

def self.reload_config!: () -> void

private

def self.names: () -> Array[Symbol]

def self.weapons: () -> Array[Object]
def self.weapons: () -> untyped

def self.sub_weapons: () -> Array[Object]
def self.sub_weapons: () -> untyped

def self.config: () -> untyped

Expand Down

0 comments on commit 2999fc7

Please sign in to comment.