-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #58 from greendrop/add_rbs
RBSを追加
- Loading branch information
Showing
6 changed files
with
162 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
class Gimei | ||
type gender_type = :female | :male | ||
|
||
GENDERS: [:male, :female] | ||
extend Forwardable | ||
self.@names: untyped # (Hash['first_name', Hash[('male' | 'female'), [String, String, String]]] | Hash['last_name', [String, String, String]]) | ||
self.@addresses: Hash['addresses', Hash[('prefecture' | 'city' | 'town'), [String, String, String]]] | ||
self.@unique: UniqueGenerator | ||
self.@config: Config | ||
|
||
attr_reader name: Name | ||
attr_reader address: Address | ||
def self.male: -> Name | ||
def self.female: -> Name | ||
def self.name: (?gender_type? gender) -> Name | ||
def self.names: -> untyped # (Hash['first_name', Hash[('male' | 'female'), [String, String, String]]] | Hash['last_name', [String, String, String]]) | ||
def self.addresses: -> Hash['addresses', Hash[('prefecture' | 'city' | 'town'), [String, String, String]]] | ||
def self.kanji: -> String | ||
def self.hiragana: -> String | ||
def self.katakana: -> String | ||
def self.romaji: -> String | ||
def self.first: -> Name::First | ||
def self.last: -> Name::Last | ||
def self.address: -> Address | ||
def self.unique: (?Integer max_retries) -> UniqueGenerator | ||
def self.config: -> Config | ||
def initialize: (?gender_type? gender) -> void | ||
alias self.family self.last | ||
alias self.given self.first | ||
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,42 @@ | ||
class Gimei | ||
class Address | ||
attr_reader prefecture: Prefecture | ||
attr_reader city: City | ||
attr_reader town: Town | ||
def initialize: -> void | ||
def kanji: -> String | ||
def hiragana: -> String | ||
def katakana: -> String | ||
def romaji: -> String | ||
|
||
class Prefecture | ||
@prefectures: [String, String, String] | ||
|
||
def kanji: -> String | ||
def hiragana: -> String | ||
def katakana: -> String | ||
def romaji: -> String | ||
def initialize: -> void | ||
end | ||
|
||
class City | ||
@cities: [String, String, String] | ||
|
||
def kanji: -> String | ||
def hiragana: -> String | ||
def katakana: -> String | ||
def romaji: -> String | ||
def initialize: -> void | ||
end | ||
|
||
class Town | ||
@towns: [String, String, String] | ||
|
||
def kanji: -> String | ||
def hiragana: -> String | ||
def katakana: -> String | ||
def romaji: -> String | ||
def initialize: -> void | ||
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,6 @@ | ||
class Gimei | ||
class Config | ||
attr_accessor rng: singleton(Random) | ||
def initialize: (?rng: singleton(Random)) -> void | ||
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,58 @@ | ||
class Gimei | ||
class Name | ||
attr_reader first: First | ||
attr_reader last: Last | ||
attr_reader gender: gender_type | ||
def self.male: -> Name | ||
def self.female: -> Name | ||
def initialize: (?(gender_type)? gender) -> void | ||
def kanji: -> String | ||
def hiragana: -> String | ||
def katakana: -> String | ||
def romaji: -> String | ||
def male?: -> bool | ||
def female?: -> bool | ||
alias family last | ||
alias given first | ||
|
||
class First | ||
extend Forwardable | ||
@gender: gender_type | ||
@name: NameWord | ||
|
||
def self.male: -> First | ||
def self.female: -> First | ||
def initialize: (?(gender_type)? gender) -> void | ||
def kanji: -> String | ||
def hiragana: -> String | ||
def katakana: -> String | ||
def to_s: -> String | ||
def romaji: -> String | ||
def male?: -> bool | ||
def female?: -> bool | ||
end | ||
|
||
class Last | ||
extend Forwardable | ||
@gender: gender_type | ||
@name: NameWord | ||
|
||
def initialize: -> void | ||
def kanji: -> String | ||
def hiragana: -> String | ||
def katakana: -> String | ||
def to_s: -> String | ||
def romaji: -> String | ||
end | ||
|
||
class NameWord | ||
@name: [String, String, String] | ||
|
||
def initialize: ([String, String, String] name) -> void | ||
def kanji: -> String | ||
def hiragana: -> String | ||
def katakana: -> String | ||
def romaji: -> String | ||
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,23 @@ | ||
class Gimei | ||
class RetryLimitExceeded < StandardError | ||
end | ||
|
||
class UniqueGenerator | ||
self.@previous_results: Hash[Symbol, Set[String]] | ||
|
||
def self.previous_results: -> Hash[Symbol, Set[String]] | ||
def initialize: (Class klass, Integer max_retries) -> void | ||
def previous_results: -> Hash[Symbol, Set[String]] | ||
def clear: (?Symbol? key) -> void | ||
def define_unique_method: (Symbol method_name, ?Symbol previous_result_key) -> Symbol | ||
def name: -> Name | ||
def first: -> Name::First | ||
def last: -> Name::Last | ||
alias family last | ||
alias given first | ||
|
||
private | ||
attr_reader klass: Class | ||
attr_reader max_retries: Integer | ||
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,3 @@ | ||
class Gimei | ||
VERSION: String | ||
end |