nomlish 0.1.0 → 0.1.1

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: 0ab64a0088cc3551872d1c0a0f1fd732676a5d2ed1ed7572af4f464666b02453
4
- data.tar.gz: 0fc19cc44f5b6c5caea451171bb32a9ade7bc4888a11ec3deeb625866e4b7db0
3
+ metadata.gz: 584a90bd1a0e9839d85b50c1b9e4b3235b34b60efadc40be4728d0f3cedcb1b0
4
+ data.tar.gz: fd12d67dc47bef80a208c7cc1d636e9a65f698718e04402092e5fdcb2559354c
5
5
  SHA512:
6
- metadata.gz: e09d3fa29c3a408cc70fc255b31b8b305e9faa4aacfc518041c4ac49c1f8dbe8e302d1a1114f229b964709b5260729c5bdf87446a616745ae94f0a44f67a0025
7
- data.tar.gz: b9bab471e10dbdb5669bfb49b4fd29025ced1a6ef2540bdd0afb3e958a8009030372e53edf2ee3cd2b0ee3216af7bc78ee4dd76ccc5b2dab2808fc96a1f354a1
6
+ metadata.gz: cc27a5b1837622f093e0f7def9e4a88afe1b7ddfaef5d85e3d3e7aabc8b4da66a690ee3a03f789dd63c60695db1f73c9e26f4aeb40ebf067bbf7e1fc7d691fab
7
+ data.tar.gz: f668c35015b93ff804eb2f9d31e0f0fb9fbb77f4da86ebbdb506b9f56c72864c03d9e119f598aebbbce4fd8c9b1176450959c4994ffb1b241afb2a25854ad450
data/README.md CHANGED
@@ -1,8 +1,7 @@
1
1
  # Nomlish
2
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/nomlish`. 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
3
+ This library makes it possible to handle "Nomlish Translation", a service that translates Japanese in a Final Fantasy style, from Ruby.
4
+ https://racing-lagoon.info/
6
5
 
7
6
  ## Installation
8
7
 
@@ -21,9 +20,22 @@ Or install it yourself as:
21
20
  $ gem install nomlish
22
21
 
23
22
  ## Usage
23
+ ```ruby
24
+ >> require "nomlish"
25
+ ```
24
26
 
25
- TODO: Write usage instructions here
27
+ ```ruby
28
+ #文字列を引数にして変換
29
+ Nomlish.translate("Rubyでノムリッシュ翻訳")
30
+ => "Rubyでノムティスリッシュ概念を共有させる"
31
+
32
+ #引数でレベルの指定やオプションの指定が可能
33
+ Nomlish.translate("Rubyでノムリッシュ翻訳", 1, "without")
34
+ => "Rubyでノムリッシュ深淵の言葉の解析"
26
35
 
36
+ Nomlish.translate("Rubyでノムリッシュ翻訳", 5, "only")
37
+ => "そうさ……俺は……RubyでNOMU……RISSHIYU翻訳…そうさ……もてあました時間を埋めるために来てるのは俺ひとりだけ…みたいだった…"
38
+ ```
27
39
  ## Development
28
40
 
29
41
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake ` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -32,7 +44,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
32
44
 
33
45
  ## Contributing
34
46
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/nomlish.
47
+ Bug reports and pull requests are welcome on GitHub at https://github.com//nomlish.
36
48
 
37
49
  ## License
38
50
 
data/lib/nomlish.rb CHANGED
@@ -1,9 +1,10 @@
1
1
  require_relative "nomlish/version"
2
2
  require "mechanize"
3
3
  module Nomlish
4
- def self.translate(text, level = 2, option = "nochk")
4
+ def self.translate(text, level = 2, option = "normal")
5
5
  nomlish_url = 'https://racing-lagoon.info/nomu/translate.php'
6
6
  agent = Mechanize.new
7
+
7
8
  page = agent.get(nomlish_url)
8
9
  form = page.forms[0]
9
10
  form.field_with(:name=>"before").value = text
@@ -15,16 +16,17 @@ module Nomlish
15
16
  result_form.forms[0].field_with(:name=>"after1").value.gsub(/[\r\n]/,"")
16
17
  end
17
18
 
18
-
19
19
  def self.set_level(level)
20
20
  0 < level && level < 6 ? level : 2
21
21
  end
22
22
 
23
23
  def self.set_auto_completion(option)
24
24
  case option
25
- when "without" then
25
+ when "normal" then #普通に翻訳
26
+ "nochk"
27
+ when "without" then #自動補完を使わず翻訳
26
28
  "p0chk"
27
- when "only" then
29
+ when "only" then #自動補完のみで翻訳
28
30
  "p100chk"
29
31
  else
30
32
  "nochk"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Nomlish
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
data/nomlish.gemspec CHANGED
@@ -16,7 +16,7 @@ from Ruby.
16
16
  EOS
17
17
  spec.homepage = "https://github.com/neruneru0419/nomlish"
18
18
  spec.license = "MIT"
19
- spec.required_ruby_version = ">= 2.4.0"
19
+ spec.required_ruby_version = ">= 2.7.0"
20
20
 
21
21
 
22
22
  # Specify which files should be added to the gem when it is released.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nomlish
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - neruneru0419
@@ -54,7 +54,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
54
54
  requirements:
55
55
  - - ">="
56
56
  - !ruby/object:Gem::Version
57
- version: 2.4.0
57
+ version: 2.7.0
58
58
  required_rubygems_version: !ruby/object:Gem::Requirement
59
59
  requirements:
60
60
  - - ">="