katsuyoujin 0.0.1.1 → 0.0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4b6e55ff20d4c15ba4df9f21f2cb1c0cd514da24
4
- data.tar.gz: 436e4214a94357db93457d762ddb15378bd0d8bc
3
+ metadata.gz: 44cfd3f22767c75014b9a50f281789113f6f260a
4
+ data.tar.gz: 2bbf9e0d4c05170863d8d71a0db24860904071ee
5
5
  SHA512:
6
- metadata.gz: 6e04c3598815c145bac17c25e9fec3aee2fd9697f0704e26790ea98d309f4300399f4a1edb46bdb714e470de444e6cd68b1cb13aaa6ec39a0806c93b30b295bd
7
- data.tar.gz: 28aa04c164417b41db55b5b55f4fca9884800b9c30c849e8880a06e60558dd262355eb1b0fd8dd0844f6fc2103bb17f2077aac99e30c6a8a97f8b7188f1b67c6
6
+ metadata.gz: bf84e89a694d05cc354a0f88583cbd3090e296ea13ae029f54694b0bb836ce6d7cfa67ad9666c5a2b9d00e7982346c3d2d621d8a7cb67db37a3703dcc8e18a61
7
+ data.tar.gz: 47592697ea54f010016b63f252d5e89fe312e446152dc8f6929faf98ff29d15032b77a7ac04315e64ddc0c0c3465ddc41b2e863824499c20410d261b2ed08e27
data/lib/katsuyoujin.rb CHANGED
@@ -6,8 +6,19 @@ require 'katsuyoujin/base'
6
6
  require 'katsuyoujin/analyzer'
7
7
 
8
8
  module Katsuyoujin
9
- CONJUGATIONS = { 'ichidan' => YAML.load_file('rules/ichidan/conjugations.yml'),
10
- 'godan' => YAML.load_file('rules/godan/conjugations.yml') }
9
+ def self.root
10
+ File.dirname __dir__
11
+ end
12
+
13
+ def self.rules
14
+ File.join root, 'rules'
15
+ end
16
+
17
+ ICHIDAN_BASE_TABLE = YAML.load_file File.join(Katsuyoujin.rules, 'ichidan/base.yml').freeze
18
+ GODAN_BASE_TABLE = YAML.load_file File.join(Katsuyoujin.rules, 'godan/base.yml').freeze
19
+
20
+ CONJUGATIONS = { 'ichidan' => YAML.load_file(File.join(rules, 'ichidan/conjugations.yml')).freeze,
21
+ 'godan' => YAML.load_file(File.join(rules, 'godan/conjugations.yml')).freeze }
11
22
 
12
23
  def self.conjugate(word, *args, category: nil, hiragana: true)
13
24
  verb = Verb.new word
@@ -29,7 +29,7 @@ module Katsuyoujin
29
29
  case
30
30
  when ['する'].include?(base_form_hiragana.chars.last(2).join) then 'irregular'
31
31
  when 'くる' == base_form_hiragana then 'irregular'
32
- when YAML.load_file('rules/godan/iru_eru.yml').include?(base_form_hiragana) then 'godan'
32
+ when YAML.load_file(File.join(Katsuyoujin.rules, 'godan/iru_eru.yml')).include?(base_form_hiragana) then 'godan'
33
33
  when ['iru', 'eru'].include?(base_form_hiragana.romaji.chars.last(3).join) then 'ichidan'
34
34
  else 'godan'
35
35
  end
@@ -2,9 +2,6 @@ module Katsuyoujin
2
2
  class Base
3
3
  attr_reader :verb, :base_letter
4
4
 
5
- ICHIDAN_BASE_TABLE = YAML.load_file 'rules/ichidan/base.yml'
6
- GODAN_BASE_TABLE = YAML.load_file 'rules/godan/base.yml'
7
-
8
5
  def initialize(verb, base_letter)
9
6
  @verb = verb
10
7
  @base_letter = base_letter
@@ -1,3 +1,3 @@
1
1
  module Katsuyoujin
2
- VERSION = '0.0.1.1'
2
+ VERSION = '0.0.1.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: katsuyoujin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1.1
4
+ version: 0.0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - LuckyThirteen