kimoby 0.0.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 +7 -0
- data/lib/kimoby.rb +28 -0
- metadata +44 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: a24703740f3c7051fde3d00c2d0b12a5cbe86bdebb7284176c20d01d2e0d33c1
|
|
4
|
+
data.tar.gz: ce0b163e22766742011f3506dab8a8ace05fc38232d409a4af40492e676959b6
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 4164dd8adefc6981af7df7825da27a362124c8bc00718460c394f358b2bfb8b89e5f7ac8cf2900a2ce11a60891a578aef67f679a15c90ef471598c54b63f284d
|
|
7
|
+
data.tar.gz: a816bfd854f13c8bebe8592c0b2a067083beaa1cc9fb1845ddecb3f150dc1b8502ee590b7e23c2f3912618522487ffaccc202d9cae0de7dd616b40153a6cf44b
|
data/lib/kimoby.rb
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Kimoby.rb
|
|
4
|
+
|
|
5
|
+
# a class to generate words
|
|
6
|
+
require './lib/utils'
|
|
7
|
+
class Kimoby
|
|
8
|
+
attr_reader :dict, :length, :res
|
|
9
|
+
|
|
10
|
+
def initialize(path, word_length = 6)
|
|
11
|
+
@dict = Utils.read_from_file(path)
|
|
12
|
+
@length = word_length
|
|
13
|
+
@res = []
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def generate(words)
|
|
17
|
+
if words.is_a?(Array) && words.size > 0
|
|
18
|
+
words.permutation(2).uniq.each do |word|
|
|
19
|
+
@res << word[0].strip + word[1].strip if word[0].strip.length + word[1].strip.length == @length
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def paginate(page = 1, per_page = 100)
|
|
25
|
+
res = @res.paginate(page: page, per_page: per_page)
|
|
26
|
+
puts "Result | #{ per_page } first word on the first page: #{res}"
|
|
27
|
+
end
|
|
28
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: kimoby
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- lionnelhost
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2022-02-28 00:00:00.000000000 Z
|
|
12
|
+
dependencies: []
|
|
13
|
+
description: A gem who generate a list of six characters words that are composed
|
|
14
|
+
of two concatenated words processed from the given dictionary
|
|
15
|
+
email: dplionnel@outlook.fr
|
|
16
|
+
executables: []
|
|
17
|
+
extensions: []
|
|
18
|
+
extra_rdoc_files: []
|
|
19
|
+
files:
|
|
20
|
+
- lib/kimoby.rb
|
|
21
|
+
homepage: https://rubygems.org/gems/kimoby
|
|
22
|
+
licenses:
|
|
23
|
+
- MIT
|
|
24
|
+
metadata: {}
|
|
25
|
+
post_install_message:
|
|
26
|
+
rdoc_options: []
|
|
27
|
+
require_paths:
|
|
28
|
+
- lib
|
|
29
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - ">="
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '0'
|
|
34
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
35
|
+
requirements:
|
|
36
|
+
- - ">="
|
|
37
|
+
- !ruby/object:Gem::Version
|
|
38
|
+
version: '0'
|
|
39
|
+
requirements: []
|
|
40
|
+
rubygems_version: 3.1.6
|
|
41
|
+
signing_key:
|
|
42
|
+
specification_version: 4
|
|
43
|
+
summary: generate list of caracters from dictionary
|
|
44
|
+
test_files: []
|