pony_breeds 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +2 -1
- data/.rubocop.yml +21 -6
- data/README.md +8 -8
- data/lib/breeds.rb +9 -0
- data/lib/pony/breeds/pony_breeds.json +20 -0
- data/lib/pony/breeds/read_pony_data.rb +41 -0
- data/lib/pony/breeds/version.rb +7 -0
- data/pony_breeds.gemspec +34 -0
- metadata +10 -9
- data/lib/pony_breeds/pony_breeds.json +0 -14
- data/lib/pony_breeds/pony_breeds.rb +0 -24
- data/lib/pony_breeds/version.rb +0 -5
- data/lib/pony_breeds.rb +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 21d17b0862a60ac023d882dfeec2e0dab387b37df44166abb947561ab1d3dc19
|
4
|
+
data.tar.gz: 55725eddb2561837c70c01433e58ff2899220eda94b35e9e99ed36596545cb35
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec1b0526edc24a1459b0ec931371bdfd80ff3911da40678c4c70b11c21c6ac2660b330a256705ba1431919fea26d97afef00a7b4aa55770db27e5c0ca508d2cd
|
7
|
+
data.tar.gz: 98f956737588f1ea972815545ee82c8bd28219fcdea7e8edceec06a6c02787dd133eb1a9f6acb26ccb94c2093bb1c3906eea6173b2b6be5f5557e8587a699cac
|
data/.rspec
CHANGED
data/.rubocop.yml
CHANGED
@@ -1,13 +1,28 @@
|
|
1
1
|
AllCops:
|
2
2
|
TargetRubyVersion: 2.6
|
3
3
|
|
4
|
-
|
5
|
-
Enabled: true
|
6
|
-
EnforcedStyle: single_quotes
|
4
|
+
# ------------------------------------------------------- Layout -------------------------------------------------------
|
7
5
|
|
8
|
-
|
9
|
-
Enabled:
|
10
|
-
|
6
|
+
Layout/EmptyLinesAroundBlockBody:
|
7
|
+
Enabled: false
|
8
|
+
|
9
|
+
Layout/EmptyLinesAroundClassBody:
|
10
|
+
Enabled: false
|
11
|
+
|
12
|
+
Layout/EmptyLinesAroundModuleBody:
|
13
|
+
Enabled: false
|
14
|
+
|
15
|
+
Layout/MultilineAssignmentLayout:
|
16
|
+
Enabled: false
|
11
17
|
|
12
18
|
Layout/LineLength:
|
13
19
|
Max: 120
|
20
|
+
|
21
|
+
# ------------------------------------------------------- Style --------------------------------------------------------
|
22
|
+
|
23
|
+
Style/ClassAndModuleChildren:
|
24
|
+
Enabled: false
|
25
|
+
|
26
|
+
Style/StringLiteralsInInterpolation:
|
27
|
+
Enabled: true
|
28
|
+
EnforcedStyle: double_quotes
|
data/README.md
CHANGED
@@ -1,24 +1,24 @@
|
|
1
1
|
# PonyBreeds
|
2
2
|
|
3
|
-
TODO: Delete this and the text below, and describe your gem
|
4
|
-
|
5
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/pony_breeds`. To experiment with that code, run `bin/console` for an interactive prompt.
|
6
4
|
|
7
5
|
## Installation
|
8
6
|
|
9
|
-
TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
|
10
|
-
|
11
7
|
Install the gem and add to the application's Gemfile by executing:
|
12
8
|
|
13
|
-
$ bundle add
|
9
|
+
$ bundle add pony_breeds
|
14
10
|
|
15
11
|
If bundler is not being used to manage dependencies, install the gem by executing:
|
16
12
|
|
17
|
-
$ gem install
|
13
|
+
$ gem install pony_breeds
|
18
14
|
|
19
15
|
## Usage
|
20
16
|
|
21
|
-
|
17
|
+
Get the pony data by the symbolized JSON key
|
18
|
+
`Pony::Breeds::ReadPonyData.new.get_pony_by_key(:symbolized_key_from_json)`
|
19
|
+
|
20
|
+
Get the pony data by the actual name of the pony
|
21
|
+
`Pony::Breeds::ReadPonyData.new.get_pony_by_name('Actual Pony Name')`
|
22
22
|
|
23
23
|
## Development
|
24
24
|
|
@@ -28,7 +28,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
28
28
|
|
29
29
|
## Contributing
|
30
30
|
|
31
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
31
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/napster235/pony_breeds. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/pony_breeds/blob/master/CODE_OF_CONDUCT.md).
|
32
32
|
|
33
33
|
## License
|
34
34
|
|
data/lib/breeds.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
{
|
2
|
+
"american_shetland_pony": {
|
3
|
+
"name": "American Shetland Pony",
|
4
|
+
"description": "The American Shetland Pony is an American breed of pony. It derives from the traditional Shetland Pony from the Shetland Isles of Scotland, but as a result of cross-breeding with other horse and pony breeds, is taller and more elegant",
|
5
|
+
"wiki_url": "https://en.wikipedia.org/wiki/American_Shetland_Pony"
|
6
|
+
},
|
7
|
+
"american_walking_pony": {
|
8
|
+
"name": "American Walking Pony",
|
9
|
+
"description": "The American Walking Pony is a modern American breed of gaited riding pony. It was created by crossbreeding of the Tennessee Walking Horse and the Welsh Pony.",
|
10
|
+
"wiki_url": "https://en.wikipedia.org/wiki/American_Walking_Pony"
|
11
|
+
},
|
12
|
+
"andalou_pony": {
|
13
|
+
"name": "Andalou Pony",
|
14
|
+
"description":"The Anadolu Pony is descended from crosses of Turkoman, Arabian, Persian, Karabakh, Akhal-Teke, Karbada, Deliboz, Mongolian and the ancient Anatolia horse. Some books refer to this small pony as the Native Turkish Pony, or Turk, but Professors Salahattin Batu and M. Nurettin Aral made a distinction in types between the horses in Anatolia as Anadolu and East and Southeast Anadolu.",
|
15
|
+
"wiki_url": "https://en.wikipedia.org/wiki/Anadolu_Pony"
|
16
|
+
},
|
17
|
+
"assateague_pony": {
|
18
|
+
|
19
|
+
}
|
20
|
+
}
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'json'
|
4
|
+
require 'active_support/core_ext/hash/keys'
|
5
|
+
|
6
|
+
module Pony
|
7
|
+
module Breeds
|
8
|
+
# The ReadPonyData class provides a way to read the pony data from the stored json file
|
9
|
+
class ReadPonyData
|
10
|
+
# Get data related to a pony by JSON key
|
11
|
+
#
|
12
|
+
# @param key [Symbol] the symbolized key used to retrieve data for a specific pony
|
13
|
+
#
|
14
|
+
# @return [Hash] the hash containing the data for the pony
|
15
|
+
def get_pony_by_key(key)
|
16
|
+
read_ponies[key.to_sym]
|
17
|
+
end
|
18
|
+
|
19
|
+
# Get data related to a pony by the actual name of the pony
|
20
|
+
#
|
21
|
+
# @param name [String] the actual name of the pony
|
22
|
+
#
|
23
|
+
# @return [Hash] the hash containing the data for the pony
|
24
|
+
def get_pony_by_name(name)
|
25
|
+
key = name&.split&.join('_')&.downcase
|
26
|
+
get_pony_by_key(key.to_sym)
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
# Read and parse the JSON file
|
32
|
+
#
|
33
|
+
# @return [Hash] the data from the json file
|
34
|
+
def read_ponies
|
35
|
+
file_location = File.dirname(__FILE__)
|
36
|
+
load_pony_breeds = File.join(file_location, 'pony_breeds.json')
|
37
|
+
JSON.parse(File.read(load_pony_breeds)).deep_symbolize_keys
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
data/pony_breeds.gemspec
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'lib/pony/breeds/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = 'pony_breeds'
|
7
|
+
spec.version = Pony::Breeds::VERSION
|
8
|
+
spec.authors = ['napster235']
|
9
|
+
spec.email = ['dragomir.tuddor@gmail.com']
|
10
|
+
|
11
|
+
spec.summary = 'A small little gem that offers the capability of reading pony breeds.'
|
12
|
+
spec.description = 'A small little gem that offers the capability of reading pony breeds.'
|
13
|
+
spec.homepage = 'https://github.com/napster235/pony_breeds'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
spec.required_ruby_version = '>= 2.6.0'
|
16
|
+
|
17
|
+
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
|
18
|
+
|
19
|
+
spec.metadata['homepage_uri'] = 'https://github.com/napster235/pony_breeds'
|
20
|
+
spec.metadata['source_code_uri'] = 'https://github.com/napster235/pony_breeds'
|
21
|
+
|
22
|
+
# Specify which files should be added to the gem when it is released.
|
23
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
24
|
+
spec.files = Dir.chdir(__dir__) do
|
25
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
26
|
+
(File.expand_path(f) == __FILE__) ||
|
27
|
+
f.start_with?(*%w[bin/ test/ spec/ features/ .git .circleci appveyor Gemfile])
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
spec.require_paths = ['lib']
|
32
|
+
|
33
|
+
spec.add_dependency 'rails', '>= 5.2', '< 7'
|
34
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pony_breeds
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- napster235
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-09-
|
11
|
+
date: 2023-09-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -30,7 +30,7 @@ dependencies:
|
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: '7'
|
33
|
-
description:
|
33
|
+
description: A small little gem that offers the capability of reading pony breeds.
|
34
34
|
email:
|
35
35
|
- dragomir.tuddor@gmail.com
|
36
36
|
executables: []
|
@@ -44,10 +44,11 @@ files:
|
|
44
44
|
- LICENSE.txt
|
45
45
|
- README.md
|
46
46
|
- Rakefile
|
47
|
-
- lib/
|
48
|
-
- lib/
|
49
|
-
- lib/
|
50
|
-
- lib/
|
47
|
+
- lib/breeds.rb
|
48
|
+
- lib/pony/breeds/pony_breeds.json
|
49
|
+
- lib/pony/breeds/read_pony_data.rb
|
50
|
+
- lib/pony/breeds/version.rb
|
51
|
+
- pony_breeds.gemspec
|
51
52
|
homepage: https://github.com/napster235/pony_breeds
|
52
53
|
licenses:
|
53
54
|
- MIT
|
@@ -73,5 +74,5 @@ requirements: []
|
|
73
74
|
rubygems_version: 3.3.7
|
74
75
|
signing_key:
|
75
76
|
specification_version: 4
|
76
|
-
summary:
|
77
|
+
summary: A small little gem that offers the capability of reading pony breeds.
|
77
78
|
test_files: []
|
@@ -1,14 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"american_shetland_pony":
|
3
|
-
{
|
4
|
-
"name": "American Shetland Pony",
|
5
|
-
"description": "The American Shetland Pony is an American breed of pony. It derives from the traditional Shetland Pony from the Shetland Isles of Scotland, but as a result of cross-breeding with other horse and pony breeds, is taller and more elegant",
|
6
|
-
"wiki_url": "https://en.wikipedia.org/wiki/American_Shetland_Pony"
|
7
|
-
},
|
8
|
-
"american_walking_pony":
|
9
|
-
{
|
10
|
-
"name": "American Walking Pony",
|
11
|
-
"description": "The American Walking Pony is a modern American breed of gaited riding pony. It was created by crossbreeding of the Tennessee Walking Horse and the Welsh Pony.",
|
12
|
-
"wiki_url": "https://en.wikipedia.org/wiki/American_Walking_Pony"
|
13
|
-
}
|
14
|
-
}
|
@@ -1,24 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'json'
|
4
|
-
require 'active_support/core_ext/hash/keys'
|
5
|
-
|
6
|
-
# Pony breeds module
|
7
|
-
module PonyBreeds
|
8
|
-
def self.get_pony_by_key(key)
|
9
|
-
read_ponies[key.to_sym]
|
10
|
-
end
|
11
|
-
|
12
|
-
def self.get_pony_name(name)
|
13
|
-
key = name.split.join('_').downcase
|
14
|
-
get_pony_by_key(key)
|
15
|
-
end
|
16
|
-
|
17
|
-
def self.read_ponies
|
18
|
-
file_location = File.dirname(__FILE__)
|
19
|
-
load_pony_breeds = File.join(file_location, 'pony_breeds.json')
|
20
|
-
JSON.parse(File.read(load_pony_breeds)).deep_symbolize_keys
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
puts PonyBreeds.get_pony_name('American Shetland Pony')
|
data/lib/pony_breeds/version.rb
DELETED