rpg_naming 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 4e9664ef635872a21386faee78f580c41ee31b51
4
+ data.tar.gz: 16aa957502a8e3b27aa1b38422e2a0cb051f2cac
5
+ SHA512:
6
+ metadata.gz: 8b0cea83b4bc022aa6d183086d6914e76b786e0228eb5511aed4fa567f686f85c28c12d83bc3de8b49db5155ef50e8c352df52d58d86c1923f16a5f77342e129
7
+ data.tar.gz: 726471bc9616865aece39398a7253094bb17f7118240acc41a6d862b28dc83df5fd741b4991a0b7c6fc9aef279fc96a6722a19e07d4ff00e791ab5e9db662945
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.2.3
5
+ before_install: gem install bundler -v 1.12.5
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in rpg_naming.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 arihh
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,36 @@
1
+ # RpgNaming
2
+
3
+ RPGに出てきそうな名前をランダムで返してくれるツールです。
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'rpg_naming'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install rpg_naming
20
+
21
+ ## Usage
22
+
23
+ ```
24
+ RpgNaming.player
25
+ => "サスケ"
26
+ ```
27
+
28
+ ## Contributing
29
+
30
+ Bug reports and pull requests are welcome on GitHub at https://github.com/arihh/rpg_naming.
31
+
32
+
33
+ ## License
34
+
35
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
36
+
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/config/names.yml ADDED
@@ -0,0 +1,28 @@
1
+ monsters:
2
+ - 'ゴブリン'
3
+ - 'スライム'
4
+ - 'ガーゴイル'
5
+ - 'リザードマン'
6
+ - 'オーク'
7
+
8
+ players:
9
+ - 'あ'
10
+ - 'う'
11
+ - 'ケイ'
12
+ - 'あみ'
13
+ - 'サスケ'
14
+ - 'かなみ'
15
+
16
+ males:
17
+ - 'ユウ'
18
+ - 'レオン'
19
+ - 'ラスク'
20
+ - 'サンダース'
21
+
22
+ females:
23
+ - 'ルキア'
24
+ - 'クララ'
25
+ - 'サツキ'
26
+ - 'アメリア'
27
+ - 'シャロン'
28
+
@@ -0,0 +1,3 @@
1
+ module RpgNaming
2
+ VERSION = "0.1.0"
3
+ end
data/lib/rpg_naming.rb ADDED
@@ -0,0 +1,43 @@
1
+ require "rpg_naming/version"
2
+ require "yaml"
3
+
4
+ module RpgNaming
5
+ class Base
6
+ def initialize(min = 0, max = nil)
7
+ @min, @max = min, max
8
+ end
9
+
10
+ [:player, :monster, :male, :female].each do |target|
11
+ class_eval("def #{target}; select_range(RpgNaming.names[pluralize('#{target}')]).sample; end")
12
+ end
13
+
14
+ def member
15
+ select_range(RpgNaming.names.values_at("males", "females").flatten).sample
16
+ end
17
+
18
+ private
19
+
20
+ def select_range(objects)
21
+ objects.select do |o|
22
+ @min <= o.length && (@max.nil? || o.length <= @max)
23
+ end
24
+ end
25
+
26
+ def pluralize(word)
27
+ # FIXME
28
+ word.concat("s")
29
+ end
30
+ end
31
+
32
+ def self.range(min = 0, max = nil)
33
+ Base.new(min, max)
34
+ end
35
+
36
+ [:player, :monster, :member, :male, :female].each do |target|
37
+ module_eval("def self.#{target}; Base.new.#{target}; end")
38
+ end
39
+
40
+ def self.names
41
+ @names ||= YAML.load_file(File.expand_path(File.join('../..', 'config', 'names.yml'), __FILE__))
42
+ end
43
+ end
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'rpg_naming/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "rpg_naming"
8
+ spec.version = RpgNaming::VERSION
9
+ spec.authors = ["arihh"]
10
+ spec.email = ["arihh0615@gmail.com"]
11
+
12
+ spec.summary = "game name random choice"
13
+ spec.description = ""
14
+ spec.homepage = "https://github.com/arihh/rpg_naming"
15
+ spec.license = "MIT"
16
+
17
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
19
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_development_dependency "bundler", "~> 1.12"
23
+ spec.add_development_dependency "rake", "~> 10.0"
24
+ spec.add_development_dependency "rspec", "~> 3.0"
25
+ end
metadata ADDED
@@ -0,0 +1,97 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rpg_naming
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - arihh
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-06-15 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.12'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.12'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ description: ''
56
+ email:
57
+ - arihh0615@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - ".rspec"
64
+ - ".travis.yml"
65
+ - Gemfile
66
+ - LICENSE.txt
67
+ - README.md
68
+ - Rakefile
69
+ - config/names.yml
70
+ - lib/rpg_naming.rb
71
+ - lib/rpg_naming/version.rb
72
+ - rpg_naming.gemspec
73
+ homepage: https://github.com/arihh/rpg_naming
74
+ licenses:
75
+ - MIT
76
+ metadata: {}
77
+ post_install_message:
78
+ rdoc_options: []
79
+ require_paths:
80
+ - lib
81
+ required_ruby_version: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ required_rubygems_version: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ requirements: []
92
+ rubyforge_project:
93
+ rubygems_version: 2.6.4
94
+ signing_key:
95
+ specification_version: 4
96
+ summary: game name random choice
97
+ test_files: []