faker-pretty_series 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1 @@
1
+ require "faker/pretty_series"
@@ -0,0 +1,13 @@
1
+ require "faker/pretty_series/version"
2
+ require "prismdb"
3
+
4
+ module Faker
5
+ module PrettySeries
6
+ class Error < StandardError; end
7
+
8
+ autoload :Character, "faker/pretty_series/character"
9
+ autoload :DataReader, "faker/pretty_series/data_reader"
10
+ autoload :Episode, "faker/pretty_series/episode"
11
+ autoload :Song, "faker/pretty_series/song"
12
+ end
13
+ end
@@ -0,0 +1,15 @@
1
+ module Faker
2
+ module PrettySeries
3
+ module Character
4
+ # @return [String]
5
+ def self.name
6
+ DataReader.sample_data("characters", "name")
7
+ end
8
+
9
+ # @return [String]
10
+ def self.cv
11
+ DataReader.sample_data("characters", "cv")
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,16 @@
1
+ module Faker
2
+ module PrettySeries
3
+ module DataReader
4
+ require "yaml"
5
+
6
+ # @param data_name [String]
7
+ # @param key [String]
8
+ def self.sample_data(data_name, key)
9
+ data = YAML.load_file("#{__dir__}/../../data/#{data_name}.yml")
10
+
11
+ values = data.map { |element| element[key] }.reject { |v| !v || v.empty? }
12
+ values.uniq.sample
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,10 @@
1
+ module Faker
2
+ module PrettySeries
3
+ module Episode
4
+ # @return [String]
5
+ def self.subtitle
6
+ DataReader.sample_data("episodes", "サブタイトル")
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ module Faker
2
+ module PrettySeries
3
+ module Song
4
+ # @return [String]
5
+ def self.name
6
+ DataReader.sample_data("songs", "name")
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,5 @@
1
+ module Faker
2
+ module PrettySeries
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,82 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: faker-pretty_series
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - sue445
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2020-03-15 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: prismdb
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
+ description: Test data generator using PrettySeries
28
+ email:
29
+ - sue445@sue445.net
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - ".coveralls.yml"
35
+ - ".github/workflows/test.yml"
36
+ - ".gitignore"
37
+ - ".rspec"
38
+ - CHANGELOG.md
39
+ - Gemfile
40
+ - LICENSE.txt
41
+ - README.md
42
+ - Rakefile
43
+ - bin/console
44
+ - bin/setup
45
+ - faker-pretty_series.gemspec
46
+ - lib/data/characters.yml
47
+ - lib/data/episodes.yml
48
+ - lib/data/songs.yml
49
+ - lib/faker-pretty_series.rb
50
+ - lib/faker/pretty_series.rb
51
+ - lib/faker/pretty_series/character.rb
52
+ - lib/faker/pretty_series/data_reader.rb
53
+ - lib/faker/pretty_series/episode.rb
54
+ - lib/faker/pretty_series/song.rb
55
+ - lib/faker/pretty_series/version.rb
56
+ homepage: https://github.com/sue445/faker-pretty_series
57
+ licenses:
58
+ - MIT
59
+ metadata:
60
+ homepage_uri: https://github.com/sue445/faker-pretty_series
61
+ source_code_uri: https://github.com/sue445/faker-pretty_series
62
+ changelog_uri: https://github.com/sue445/faker-pretty_series/blob/master/CHANGELOG.md
63
+ post_install_message:
64
+ rdoc_options: []
65
+ require_paths:
66
+ - lib
67
+ required_ruby_version: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ version: 2.5.0
72
+ required_rubygems_version: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ requirements: []
78
+ rubygems_version: 3.1.2
79
+ signing_key:
80
+ specification_version: 4
81
+ summary: Test data generator using PrettySeries
82
+ test_files: []