habluhablu 0.1.7 → 0.1.8

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a139af18af686c3cfdca72db3e1691713b38e98c6b9e0030630829e8239b78b1
4
- data.tar.gz: c0a5e41e48a23e3e340f703ac964e27c65e067378d7370d367403c52269c8c47
3
+ metadata.gz: dc476e07b80a4042c248b300231f5fd17694b312ddd92394f271d3d01a96b324
4
+ data.tar.gz: 03744b2f86b753e8214170b9e88d8ec6f28ff21a9b095316f82ab6c5396c4a3a
5
5
  SHA512:
6
- metadata.gz: 3f695a26b0f09a61e426e87d9b342a67223570138e521846085bbb3d631bab8db1f1c3740c9a19857d85dab3c0a9f5edbcd1f32c176384b779b9a10f8185921a
7
- data.tar.gz: e75d9b71af4ae783332242d53c42660e29387587006af2339f0de1f82f189f46544b54a5e3b9bb2a845d94f14f223a93dc710e79c95778deb17975207849d1ac
6
+ metadata.gz: f82483807351061a84eae7041c34ea6ca748d36b4029882c4c962bc3a9084ff29ccddf0ff4e47a96ca5ee3eacd2dc9d6c87b01c3620b8a28398fb692789b67e4
7
+ data.tar.gz: 3ca218a1bf5bcb5d688f02d200bc924e4e8f302a4117486bda6b169893cf364f74da9b6da3c052f2322d03ea4f734dc02c04435e06dd660765dccf4110c22439
data/.rubocop.yml CHANGED
@@ -18,7 +18,7 @@ Layout/LineLength:
18
18
  Max: 120
19
19
 
20
20
  Metrics/MethodLength:
21
- Max: 11
21
+ Max: 20
22
22
 
23
23
  Style/IfUnlessModifier:
24
24
  Exclude:
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- habluhablu (0.1.7)
4
+ habluhablu (0.1.8)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -38,6 +38,8 @@ Or install it yourself as:
38
38
  Generate file for a specific language using `habluhablu -l <symbol>` command.
39
39
  [List of symbols](https://www.w3.org/International/O-charset-lang.html)
40
40
 
41
+ `habluhablu --help`
42
+
41
43
  ### Contributing
42
44
 
43
45
  Bug reports and pull requests are welcome on GitHub at https://github.com/patrickgramatowski/habluhablu_gem.
data/habluhablu.gemspec CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
 
11
11
  spec.summary = "HabluHablu makes it easier to use I18n."
12
12
  spec.description = "The gem allows you to generate language file with translations of the most useful phrases."
13
- spec.homepage = "https://github.com/patrickgramatowski/habluhablu"
13
+ spec.homepage = "https://github.com/patrickgramatowski/habluhablu_gem"
14
14
  spec.license = "MIT"
15
15
  spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
16
16
 
data/lib/habluhablu.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "habluhablu/version"
4
+ require_relative "languages/languages"
4
5
 
5
6
  # Module HabluHablu
6
7
  module Habluhablu
@@ -29,15 +30,14 @@ module Habluhablu
29
30
 
30
31
  # Check if specified symbol's language does exist
31
32
  # if not, raise the custom error
32
- if File.exist?("languages/#{language}.yml").eql?(false)
33
+ language_class = Languages.new(language)
34
+ if language_class.include_language? == false
33
35
  raise WrongSymbolError.new(language)
34
36
  end
35
37
 
36
38
  # Create a file of specified language
37
39
  File.open("./config/locales/#{language}.yml", "w") do |f|
38
- File.open("languages/#{language}.yml") do |i18n|
39
- f.write(i18n.read.to_s)
40
- end
40
+ f.write(language_class.render)
41
41
  end
42
42
  end
43
43
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Habluhablu
4
- VERSION = "0.1.7"
4
+ VERSION = "0.1.8"
5
5
  end
File without changes
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "yaml"
4
+
5
+ # Class comment
6
+ class Languages
7
+ def initialize(language)
8
+ @language = language.to_sym
9
+ @languages = {
10
+ ar: {
11
+ ar: { welcome: "مرحبا" }
12
+ },
13
+ en: {
14
+ en: { welcome: "Welcome" }
15
+ },
16
+ es: {
17
+ es: { welcome: "Bienvenido" }
18
+ },
19
+ pl: {
20
+ pl: { welcome: "Witaj" }
21
+ },
22
+ iw: {
23
+ iw: { welcome: "שלום" }
24
+ }
25
+ }
26
+ end
27
+
28
+ def include_language?
29
+ @languages.key?(@language) ? true : false
30
+ end
31
+
32
+ def render
33
+ @languages.key?(@language) ? @languages[@language].to_yaml : "No language in the lib."
34
+ end
35
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: habluhablu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patrick Gramatowski
@@ -33,22 +33,18 @@ files:
33
33
  - bin/setup
34
34
  - exe/habluhablu
35
35
  - habluhablu.gemspec
36
- - languages/Countries_Flags.md
37
- - languages/ar.yml
38
- - languages/en.yml
39
- - languages/es.yml
40
- - languages/iw.yml
41
- - languages/pl.yml
42
36
  - lib/habluhablu.rb
43
37
  - lib/habluhablu/version.rb
44
- homepage: https://github.com/patrickgramatowski/habluhablu
38
+ - lib/languages/Countries_Flags.md
39
+ - lib/languages/languages.rb
40
+ homepage: https://github.com/patrickgramatowski/habluhablu_gem
45
41
  licenses:
46
42
  - MIT
47
43
  metadata:
48
44
  allowed_push_host: https://rubygems.org
49
- homepage_uri: https://github.com/patrickgramatowski/habluhablu
50
- source_code_uri: https://github.com/patrickgramatowski/habluhablu
51
- changelog_uri: https://github.com/patrickgramatowski/habluhablu/CHANGELOG.md
45
+ homepage_uri: https://github.com/patrickgramatowski/habluhablu_gem
46
+ source_code_uri: https://github.com/patrickgramatowski/habluhablu_gem
47
+ changelog_uri: https://github.com/patrickgramatowski/habluhablu_gem/CHANGELOG.md
52
48
  post_install_message:
53
49
  rdoc_options: []
54
50
  require_paths:
data/languages/ar.yml DELETED
@@ -1,2 +0,0 @@
1
- ar:
2
- welcome: "مرحبا"
data/languages/en.yml DELETED
@@ -1,2 +0,0 @@
1
- en:
2
- welcome: "Welcome"
data/languages/es.yml DELETED
@@ -1,2 +0,0 @@
1
- es:
2
- welcome: "Bienvenido"
data/languages/iw.yml DELETED
@@ -1,2 +0,0 @@
1
- iw:
2
- welcome: "שלום"
data/languages/pl.yml DELETED
@@ -1,2 +0,0 @@
1
- pl:
2
- welcome: "Witaj"