rubi_live 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 23979f8d87dba06b0c6e3d5b8f2ebb0ca8716583
4
+ data.tar.gz: 58fe8b0a32ef1ba068ce0e280c5ff4a1ea26a14c
5
+ SHA512:
6
+ metadata.gz: 9e4b14a01b11e8817c3dffffd218d605500b34c75862627de05b641508dddee45c7624048cc9e9dd5ddea4d171905bfdcf232c7e79ecb3a605215b2501305624
7
+ data.tar.gz: 4366400e0e80e60d1ff3b4a5b1e057174e6ffa2197356e2b5eaa58ca1d148ff1f6605d5ad961ff965cf6cb864a10a0eaa0da82e8a972f9b28f7e8dd20b7f39ae
data/.gitignore ADDED
@@ -0,0 +1,56 @@
1
+
2
+ # Created by https://www.gitignore.io/api/ruby
3
+
4
+ ### Ruby ###
5
+ *.gem
6
+ *.rbc
7
+ /.config
8
+ /coverage/
9
+ /InstalledFiles
10
+ /pkg/
11
+ /spec/reports/
12
+ /spec/examples.txt
13
+ /test/tmp/
14
+ /test/version_tmp/
15
+ /tmp/
16
+
17
+ # Used by dotenv library to load environment variables.
18
+ # .env
19
+
20
+ ## Specific to RubyMotion:
21
+ .dat*
22
+ .repl_history
23
+ build/
24
+ *.bridgesupport
25
+ build-iPhoneOS/
26
+ build-iPhoneSimulator/
27
+
28
+ ## Specific to RubyMotion (use of CocoaPods):
29
+ #
30
+ # We recommend against adding the Pods directory to your .gitignore. However
31
+ # you should judge for yourself, the pros and cons are mentioned at:
32
+ # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
33
+ #
34
+ # vendor/Pods/
35
+
36
+ ## Documentation cache and generated files:
37
+ /.yardoc/
38
+ /_yardoc/
39
+ /doc/
40
+ /rdoc/
41
+
42
+ ## Environment normalization:
43
+ /.bundle/
44
+ /vendor/bundle
45
+ /lib/bundler/man/
46
+
47
+ # for a library or gem, you might want to ignore these files since the code is
48
+ # intended to run in multiple environments; otherwise, check them in:
49
+ # Gemfile.lock
50
+ # .ruby-version
51
+ # .ruby-gemset
52
+
53
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
54
+ .rvmrc
55
+
56
+ # End of https://www.gitignore.io/api/ruby
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.3.3
5
+ before_install: gem install bundler -v 1.13.6
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at develop.tanoc@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in rubi_live.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,57 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ rubi_live (0.0.1)
5
+ activesupport
6
+ hashie
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ activesupport (5.0.1)
12
+ concurrent-ruby (~> 1.0, >= 1.0.2)
13
+ i18n (~> 0.7)
14
+ minitest (~> 5.1)
15
+ tzinfo (~> 1.1)
16
+ coderay (1.1.1)
17
+ concurrent-ruby (1.0.3)
18
+ diff-lcs (1.2.5)
19
+ hashie (3.4.6)
20
+ i18n (0.7.0)
21
+ method_source (0.8.2)
22
+ minitest (5.10.1)
23
+ pry (0.10.4)
24
+ coderay (~> 1.1.0)
25
+ method_source (~> 0.8.1)
26
+ slop (~> 3.4)
27
+ rake (10.5.0)
28
+ rspec (3.5.0)
29
+ rspec-core (~> 3.5.0)
30
+ rspec-expectations (~> 3.5.0)
31
+ rspec-mocks (~> 3.5.0)
32
+ rspec-core (3.5.4)
33
+ rspec-support (~> 3.5.0)
34
+ rspec-expectations (3.5.0)
35
+ diff-lcs (>= 1.2.0, < 2.0)
36
+ rspec-support (~> 3.5.0)
37
+ rspec-mocks (3.5.0)
38
+ diff-lcs (>= 1.2.0, < 2.0)
39
+ rspec-support (~> 3.5.0)
40
+ rspec-support (3.5.0)
41
+ slop (3.6.0)
42
+ thread_safe (0.3.5)
43
+ tzinfo (1.2.2)
44
+ thread_safe (~> 0.1)
45
+
46
+ PLATFORMS
47
+ ruby
48
+
49
+ DEPENDENCIES
50
+ bundler (~> 1.13)
51
+ pry
52
+ rake (~> 10.0)
53
+ rspec (~> 3.0)
54
+ rubi_live!
55
+
56
+ BUNDLED WITH
57
+ 1.13.6
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 techno-tanoC
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,41 @@
1
+ # RubiLive
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/rubi_live`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'rubi_live'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install rubi_live
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/rubi_live. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
36
+
37
+
38
+ ## License
39
+
40
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
41
+
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/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "rubi_live"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,71 @@
1
+ rin:
2
+ name: 星空凛
3
+ school_year: 1
4
+ birthday: 11/01
5
+ blood_type: A
6
+ height: 155
7
+ cast_name: 飯田里穂
8
+
9
+ hanayo:
10
+ name: 小泉花陽
11
+ school_year: 1
12
+ birthday: 01/17
13
+ blood_type: B
14
+ height: 156
15
+ cast_name: 久保ユリカ
16
+
17
+ maki:
18
+ name: 西木野真姫
19
+ school_year: 1
20
+ birthday: 04/19
21
+ blood_type: AB
22
+ height: 161
23
+ cast_name: Pile
24
+
25
+ honoka:
26
+ name: 高坂穂乃果
27
+ school_year: 2
28
+ birthday: 08/03
29
+ blood_type: O
30
+ height: 157
31
+ cast_name: 新田恵海
32
+
33
+ umi:
34
+ name: 園田海未
35
+ school_year: 2
36
+ birthday: 03/15
37
+ blood_type: A
38
+ height: 159
39
+ cast_name: 三森すずこ
40
+
41
+ kotori:
42
+ name: 南ことり
43
+ school_year: 2
44
+ birthday: 09/12
45
+ blood_type: O
46
+ height: 159
47
+ cast_name: 内田彩
48
+
49
+ eli:
50
+ name: 絢瀬絵里
51
+ school_year: 3
52
+ birthday: 10/21
53
+ blood_type: B
54
+ height: 162
55
+ cast_name: 南條愛乃
56
+
57
+ nozomi:
58
+ name: 東條希
59
+ school_year: 3
60
+ birthday: 06/09
61
+ blood_type: O
62
+ height: 159
63
+ cast_name: 楠田亜衣奈
64
+
65
+ nico:
66
+ name: 矢澤にこ
67
+ school_year: 3
68
+ birthday: 07/22
69
+ blood_type: A
70
+ height: 154
71
+ cast_name: 徳井青空
@@ -0,0 +1,71 @@
1
+ yoshiko:
2
+ name: 津島善子
3
+ school_year: 1
4
+ birthday: 07/13
5
+ blood_type: O
6
+ height: 156
7
+ cast_name: 小林愛香
8
+
9
+ hanamaru:
10
+ name: 国木田花丸
11
+ school_year: 1
12
+ birthday: 03/04
13
+ blood_type: O
14
+ height: 152
15
+ cast_name: 高槻かなこ
16
+
17
+ ruby:
18
+ name: 黒澤ルビィ
19
+ school_year: 1
20
+ birthday: 09/21
21
+ blood_type: A
22
+ height: 154
23
+ cast_name: 降幡愛
24
+
25
+ chika:
26
+ name: 高海千歌
27
+ school_year: 2
28
+ birthday: 08/01
29
+ blood_type : B
30
+ height: 157
31
+ cast_name: 伊波杏樹
32
+
33
+ riko:
34
+ name: 桜内梨子
35
+ school_year: 2
36
+ birthday: 09/19
37
+ blood_type: A
38
+ height: 160
39
+ cast_name: 逢田梨香子
40
+
41
+ you:
42
+ name: 渡辺曜
43
+ school_year: 2
44
+ birthday: 04/17
45
+ blood_type: AB
46
+ height: 157
47
+ cast_name: 斉藤朱夏
48
+
49
+ kanan:
50
+ name: 松浦果南
51
+ school_year: 3
52
+ birthday: 02/10
53
+ blood_type: O
54
+ height: 162
55
+ cast_name: 諏訪ななか
56
+
57
+ dia:
58
+ name: 黒澤ダイヤ
59
+ school_year: 3
60
+ birthday: 01/01
61
+ blood_type: A
62
+ height: 162
63
+ cast_name: 小宮有紗
64
+
65
+ mari:
66
+ name: 小原鞠莉
67
+ school_year: 3
68
+ birthday: 06/13
69
+ blood_type: AB
70
+ height: 163
71
+ cast_name: 鈴木愛奈
data/config/idols.yml ADDED
@@ -0,0 +1,143 @@
1
+ rin:
2
+ name: 星空凛
3
+ school_year: 1
4
+ birthday: 11/01
5
+ blood_type: A
6
+ height: 155
7
+ cast_name: 飯田里穂
8
+
9
+ hanayo:
10
+ name: 小泉花陽
11
+ school_year: 1
12
+ birthday: 01/17
13
+ blood_type: B
14
+ height: 156
15
+ cast_name: 久保ユリカ
16
+
17
+ maki:
18
+ name: 西木野真姫
19
+ school_year: 1
20
+ birthday: 04/19
21
+ blood_type: AB
22
+ height: 161
23
+ cast_name: Pile
24
+
25
+ honoka:
26
+ name: 高坂穂乃果
27
+ school_year: 2
28
+ birthday: 08/03
29
+ blood_type: O
30
+ height: 157
31
+ cast_name: 新田恵海
32
+
33
+ umi:
34
+ name: 園田海未
35
+ school_year: 2
36
+ birthday: 03/15
37
+ blood_type: A
38
+ height: 159
39
+ cast_name: 三森すずこ
40
+
41
+ kotori:
42
+ name: 南ことり
43
+ school_year: 2
44
+ birthday: 09/12
45
+ blood_type: O
46
+ height: 159
47
+ cast_name: 内田彩
48
+
49
+ eli:
50
+ name: 絢瀬絵里
51
+ school_year: 3
52
+ birthday: 10/21
53
+ blood_type: B
54
+ height: 162
55
+ cast_name: 南條愛乃
56
+
57
+ nozomi:
58
+ name: 東條希
59
+ school_year: 3
60
+ birthday: 06/09
61
+ blood_type: O
62
+ height: 159
63
+ cast_name: 楠田亜衣奈
64
+
65
+ nico:
66
+ name: 矢澤にこ
67
+ school_year: 3
68
+ birthday: 07/22
69
+ blood_type: A
70
+ height: 154
71
+ cast_name: 徳井青空
72
+
73
+ yoshiko:
74
+ name: 津島善子
75
+ school_year: 1
76
+ birthday: 07/13
77
+ blood_type: O
78
+ height: 156
79
+ cast_name: 小林愛香
80
+
81
+ hanamaru:
82
+ name: 国木田花丸
83
+ school_year: 1
84
+ birthday: 03/04
85
+ blood_type: O
86
+ height: 152
87
+ cast_name: 高槻かなこ
88
+
89
+ ruby:
90
+ name: 黒澤ルビィ
91
+ school_year: 1
92
+ birthday: 09/21
93
+ blood_type: A
94
+ height: 154
95
+ cast_name: 降幡愛
96
+
97
+ chika:
98
+ name: 高海千歌
99
+ school_year: 2
100
+ birthday: 08/01
101
+ blood_type : B
102
+ height: 157
103
+ cast_name: 伊波杏樹
104
+
105
+ riko:
106
+ name: 桜内梨子
107
+ school_year: 2
108
+ birthday: 09/19
109
+ blood_type: A
110
+ height: 160
111
+ cast_name: 逢田梨香子
112
+
113
+ you:
114
+ name: 渡辺曜
115
+ school_year: 2
116
+ birthday: 04/17
117
+ blood_type: AB
118
+ height: 157
119
+ cast_name: 斉藤朱夏
120
+
121
+ kanan:
122
+ name: 松浦果南
123
+ school_year: 3
124
+ birthday: 02/10
125
+ blood_type: O
126
+ height: 162
127
+ cast_name: 諏訪ななか
128
+
129
+ dia:
130
+ name: 黒澤ダイヤ
131
+ school_year: 3
132
+ birthday: 01/01
133
+ blood_type: A
134
+ height: 162
135
+ cast_name: 小宮有紗
136
+
137
+ mari:
138
+ name: 小原鞠莉
139
+ school_year: 3
140
+ birthday: 06/13
141
+ blood_type: AB
142
+ height: 163
143
+ cast_name: 鈴木愛奈
data/config/series.yml ADDED
@@ -0,0 +1,35 @@
1
+ unmarked:
2
+ title: ラブライブ!
3
+ unit: μ's
4
+ trio_units:
5
+ - printemps
6
+ - bibi
7
+ - lily_white
8
+ idols:
9
+ - rin
10
+ - hanayo
11
+ - maki
12
+ - honoka
13
+ - umi
14
+ - kotori
15
+ - eli
16
+ - nozomi
17
+ - nico
18
+
19
+ sunshine:
20
+ title: ラブライブ!サンシャイン!!
21
+ unit: aqours
22
+ trio_units:
23
+ - cyaron
24
+ - azalea
25
+ - guilty_kiss
26
+ idols:
27
+ - yoshiko
28
+ - hanamaru
29
+ - ruby
30
+ - chika
31
+ - riko
32
+ - you
33
+ - kanan
34
+ - dia
35
+ - mari
data/config/units.yml ADDED
@@ -0,0 +1,41 @@
1
+ printemps:
2
+ name: Printemps
3
+ idols:
4
+ - hanayo
5
+ - honoka
6
+ - kotori
7
+
8
+ bibi:
9
+ name: BiBi
10
+ idols:
11
+ - maki
12
+ - eli
13
+ - nico
14
+
15
+ lily_white:
16
+ name: Lili White
17
+ idols:
18
+ - rin
19
+ - umi
20
+ - nozomi
21
+
22
+ cyaron:
23
+ name: CYaRon!
24
+ idols:
25
+ - ruby
26
+ - chika
27
+ - you
28
+
29
+ azalea:
30
+ name: AZALEA
31
+ idols:
32
+ - hanamaru
33
+ - kanan
34
+ - dia
35
+
36
+ guilty_kiss:
37
+ name: Guilty Kiss
38
+ idols:
39
+ - yoshiko
40
+ - riko
41
+ - mari
@@ -0,0 +1,5 @@
1
+ module RubiLive
2
+ class UnknownIdolError < StandardError; end
3
+ class UnknownUnitError < StandardError; end
4
+ class UnknownSeriesError < StandardError; end
5
+ end
@@ -0,0 +1,45 @@
1
+ module RubiLive
2
+ class Idol < Hash
3
+ include Hashie::Extensions::MethodAccess
4
+
5
+ def ==(other)
6
+ other.is_a?(self.class) && self.name == other.name
7
+ end
8
+
9
+ def birthday?(date = Date.today)
10
+ month, day = birthday.split("/")
11
+ birthday_date = Date.new(date.year, month.to_i, day.to_i)
12
+ birthday_date == date
13
+ end
14
+
15
+ class << self
16
+ ConfigPath = config_file = "#{File.dirname(__FILE__)}/../../config/idols.yml"
17
+ private_constant :ConfigPath
18
+
19
+ def config
20
+ @config ||= YAML.load_file(ConfigPath).deep_symbolize_keys
21
+ end
22
+
23
+ def find(name)
24
+ idol_name = name.to_sym
25
+ raise "unknown idol: #{name}" unless valid?(idol_name)
26
+
27
+ @cache ||= {}
28
+ unless @cache[idol_name]
29
+ idol_config = config[idol_name]
30
+ @cache[idol_name] = RubiLive::Idol[idol_config]
31
+ end
32
+
33
+ @cache[idol_name]
34
+ end
35
+
36
+ def names
37
+ config.keys
38
+ end
39
+
40
+ def valid?(idol_name)
41
+ names.include?(idol_name)
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,52 @@
1
+ module RubiLive
2
+ class Series < Hash
3
+ include Hashie::Extensions::MethodAccess
4
+ include Enumerable
5
+
6
+ def members
7
+ self[:idols].map do |member|
8
+ RubiLive::Idol.find(member)
9
+ end
10
+ end
11
+
12
+ def trio_units
13
+ self[:trio_units].map do |trio_unit|
14
+ RubiLive::Unit.find(trio_unit)
15
+ end
16
+ end
17
+
18
+ def each(&block)
19
+ members.each(&block)
20
+ end
21
+
22
+ class << self
23
+ ConfigPath = config_file = "#{File.dirname(__FILE__)}/../../config/series.yml"
24
+ private_constant :ConfigPath
25
+
26
+ def config
27
+ @config ||= YAML.load_file(ConfigPath).deep_symbolize_keys
28
+ end
29
+
30
+ def find(name)
31
+ series_name = name.to_sym
32
+ raise UnknownSeriesError unless valid?(series_name)
33
+
34
+ @cache ||= {}
35
+ unless @cache[series_name]
36
+ series_config = config[series_name]
37
+ @cache[series_name] = RubiLive::Series[series_config]
38
+ end
39
+
40
+ @cache[series_name]
41
+ end
42
+
43
+ def names
44
+ config.keys
45
+ end
46
+
47
+ def valid?(series_name)
48
+ names.include?(series_name)
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,46 @@
1
+ module RubiLive
2
+ class Unit < Hash
3
+ include Hashie::Extensions::MethodAccess
4
+ include Enumerable
5
+
6
+ def members
7
+ self[:idols].map do |member|
8
+ RubiLive::Idol.find(member.to_sym)
9
+ end
10
+ end
11
+
12
+ def each(&block)
13
+ members.each(&block)
14
+ end
15
+
16
+ class << self
17
+ ConfigPath = config_file = "#{File.dirname(__FILE__)}/../../config/units.yml"
18
+ private_constant :ConfigPath
19
+
20
+ def config
21
+ @config ||= YAML.load_file(ConfigPath).deep_symbolize_keys
22
+ end
23
+
24
+ def find(name)
25
+ unit_name = name.to_sym
26
+ raise UnknownUnitError unless valid?(unit_name)
27
+
28
+ @cache ||= {}
29
+ unless @cache[unit_name]
30
+ unit_config = config[unit_name]
31
+ @cache[unit_name] = RubiLive::Unit[unit_config]
32
+ end
33
+
34
+ @cache[unit_name]
35
+ end
36
+
37
+ def names
38
+ config.keys
39
+ end
40
+
41
+ def valid?(unit_name)
42
+ names.include?(unit_name)
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,3 @@
1
+ module RubiLive
2
+ VERSION = "0.0.1"
3
+ end
data/lib/rubi_live.rb ADDED
@@ -0,0 +1,20 @@
1
+ require 'active_support/all'
2
+ require 'hashie'
3
+ require 'yaml'
4
+ require 'rubi_live/version'
5
+ require 'rubi_live/idol'
6
+ require 'rubi_live/unit'
7
+ require 'rubi_live/series'
8
+ require 'rubi_live/errors'
9
+
10
+ module RubiLive
11
+ class << self
12
+ [RubiLive::Series, RubiLive::Unit, RubiLive::Idol].each do |klass|
13
+ klass.names.each do |name|
14
+ define_method(name) do
15
+ klass.find(name)
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
data/lib/ubi_live.rb ADDED
@@ -0,0 +1 @@
1
+ require "rubi_live"
data/rubi_live.gemspec ADDED
@@ -0,0 +1,40 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'rubi_live/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "rubi_live"
8
+ spec.version = RubiLive::VERSION
9
+ spec.authors = ["techno-tanoC"]
10
+ spec.email = ["develop.tanoc@gmail.com"]
11
+
12
+ spec.summary = 'All about Japanese multimedia project "Love Live!"'
13
+ spec.description = 'All about Japanese multimedia project "Love Live!"'
14
+ spec.homepage = "https://github.com/techno-tanoC/rubi_live"
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
+ # if spec.respond_to?(:metadata)
20
+ # spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
21
+ # else
22
+ # raise "RubyGems 2.0 or newer is required to protect against " \
23
+ # "public gem pushes."
24
+ # end
25
+
26
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
27
+ f.match(%r{^(test|spec|features)/})
28
+ end
29
+ spec.bindir = "exe"
30
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
31
+ spec.require_paths = ["lib"]
32
+
33
+ spec.add_dependency "activesupport"
34
+ spec.add_dependency "hashie"
35
+
36
+ spec.add_development_dependency "bundler", "~> 1.13"
37
+ spec.add_development_dependency "rake", "~> 10.0"
38
+ spec.add_development_dependency "rspec", "~> 3.0"
39
+ spec.add_development_dependency "pry"
40
+ end
metadata ADDED
@@ -0,0 +1,152 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rubi_live
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - techno-tanoC
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-12-24 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activesupport
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: hashie
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.13'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.13'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '10.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: pry
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ description: All about Japanese multimedia project "Love Live!"
98
+ email:
99
+ - develop.tanoc@gmail.com
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - ".gitignore"
105
+ - ".rspec"
106
+ - ".travis.yml"
107
+ - CODE_OF_CONDUCT.md
108
+ - Gemfile
109
+ - Gemfile.lock
110
+ - LICENSE.txt
111
+ - README.md
112
+ - Rakefile
113
+ - bin/console
114
+ - bin/setup
115
+ - config/idols.yml
116
+ - config/idols/001_unmarked.yml
117
+ - config/idols/002_sunshine.yml
118
+ - config/series.yml
119
+ - config/units.yml
120
+ - lib/rubi_live.rb
121
+ - lib/rubi_live/errors.rb
122
+ - lib/rubi_live/idol.rb
123
+ - lib/rubi_live/series.rb
124
+ - lib/rubi_live/unit.rb
125
+ - lib/rubi_live/version.rb
126
+ - lib/ubi_live.rb
127
+ - rubi_live.gemspec
128
+ homepage: https://github.com/techno-tanoC/rubi_live
129
+ licenses:
130
+ - MIT
131
+ metadata: {}
132
+ post_install_message:
133
+ rdoc_options: []
134
+ require_paths:
135
+ - lib
136
+ required_ruby_version: !ruby/object:Gem::Requirement
137
+ requirements:
138
+ - - ">="
139
+ - !ruby/object:Gem::Version
140
+ version: '0'
141
+ required_rubygems_version: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ requirements: []
147
+ rubyforge_project:
148
+ rubygems_version: 2.5.2
149
+ signing_key:
150
+ specification_version: 4
151
+ summary: All about Japanese multimedia project "Love Live!"
152
+ test_files: []