russial 0.5.2 → 0.5.3
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 +4 -4
 - data/README.md +18 -18
 - data/lib/russial/dictionary/dynamic_methods.rb +7 -1
 - data/lib/russial/version.rb +1 -1
 - data/russial.gemspec +1 -0
 - metadata +16 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 738361c2494919a080ebce961a1bcc9a43b3eeba
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: b0021e4ca9c8f4ed96e1881e43048f0d2599eeae
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 83c5823086fc1e3e740905089447030adc5986836564924426c79b6995f1dab39c3b91c58aa657d964ca262ed72ba09609adb7131bded9bce9d9c9a87ca82413
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: ee368bb95c28fd226410cc6d8324cac2dff6318d03e34b11d96a8cb689a2e502e81488bbb59edbba30111949c00b2ed1283a13b08f65071fa00bc05682eafc04
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -5,20 +5,20 @@ An easy way to make word declension. 
     | 
|
| 
       5 
5 
     | 
    
         
             
            ## Installation
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
7 
     | 
    
         
             
            Add this line to your application's Gemfile:
         
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
      
 8 
     | 
    
         
            +
            ```ruby
         
     | 
| 
       9 
9 
     | 
    
         
             
            gem "russial"
         
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
      
 10 
     | 
    
         
            +
            ```
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
       12 
12 
     | 
    
         
             
            And then execute:
         
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
      
 13 
     | 
    
         
            +
            ```
         
     | 
| 
       14 
14 
     | 
    
         
             
            $ bundle
         
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
      
 15 
     | 
    
         
            +
            ```
         
     | 
| 
       16 
16 
     | 
    
         | 
| 
       17 
17 
     | 
    
         
             
            Or install it yourself as:
         
     | 
| 
       18 
18 
     | 
    
         | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
      
 19 
     | 
    
         
            +
            ```
         
     | 
| 
       20 
20 
     | 
    
         
             
            $ gem install russial
         
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
      
 21 
     | 
    
         
            +
            ```
         
     | 
| 
       22 
22 
     | 
    
         | 
| 
       23 
23 
     | 
    
         
             
            **Note:** for Rubies less than 2.3.0 we use `backport_dig` gem, but we strongly recommend you to upgrade your Ruby version to the last one.
         
     | 
| 
       24 
24 
     | 
    
         | 
| 
         @@ -30,7 +30,7 @@ The Russial gem automatically works with any structures that you pass as diction 
     | 
|
| 
       30 
30 
     | 
    
         | 
| 
       31 
31 
     | 
    
         
             
            With plain Ruby it's looks like:
         
     | 
| 
       32 
32 
     | 
    
         | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
      
 33 
     | 
    
         
            +
            ```ruby
         
     | 
| 
       34 
34 
     | 
    
         
             
            ruby_dictionary = {
         
     | 
| 
       35 
35 
     | 
    
         
             
              ruby: {
         
     | 
| 
       36 
36 
     | 
    
         
             
                singular: {
         
     | 
| 
         @@ -63,13 +63,13 @@ plural_word = word.plural 
     | 
|
| 
       63 
63 
     | 
    
         
             
            # Get cases of plural form
         
     | 
| 
       64 
64 
     | 
    
         
             
            plural_word.genitive # "рубинов"
         
     | 
| 
       65 
65 
     | 
    
         
             
            plural_word.instrumental # "рубинами"
         
     | 
| 
       66 
     | 
    
         
            -
             
     | 
| 
      
 66 
     | 
    
         
            +
            ```
         
     | 
| 
       67 
67 
     | 
    
         | 
| 
       68 
68 
     | 
    
         
             
            ### With I18n/Rails
         
     | 
| 
       69 
69 
     | 
    
         | 
| 
       70 
70 
     | 
    
         
             
            With I18n/Rails support you need to add dictionary to locales. For example in file *`russial.yml`*:
         
     | 
| 
       71 
71 
     | 
    
         | 
| 
       72 
     | 
    
         
            -
             
     | 
| 
      
 72 
     | 
    
         
            +
            ```yaml
         
     | 
| 
       73 
73 
     | 
    
         
             
            ru:
         
     | 
| 
       74 
74 
     | 
    
         
             
              russial:
         
     | 
| 
       75 
75 
     | 
    
         
             
                идти:
         
     | 
| 
         @@ -80,11 +80,11 @@ ru: 
     | 
|
| 
       80 
80 
     | 
    
         
             
                      female: прошла
         
     | 
| 
       81 
81 
     | 
    
         
             
                    plural: прошли
         
     | 
| 
       82 
82 
     | 
    
         
             
                  present: проходит
         
     | 
| 
       83 
     | 
    
         
            -
             
     | 
| 
      
 83 
     | 
    
         
            +
            ```
         
     | 
| 
       84 
84 
     | 
    
         | 
| 
       85 
85 
     | 
    
         
             
            And then:
         
     | 
| 
       86 
86 
     | 
    
         | 
| 
       87 
     | 
    
         
            -
             
     | 
| 
      
 87 
     | 
    
         
            +
            ```ruby
         
     | 
| 
       88 
88 
     | 
    
         
             
            # Rails wiil do this automatically
         
     | 
| 
       89 
89 
     | 
    
         
             
            I18n.tap do |c|
         
     | 
| 
       90 
90 
     | 
    
         
             
              c.available_locales = [:ru]
         
     | 
| 
         @@ -97,7 +97,7 @@ word = Russial.new("идти") 
     | 
|
| 
       97 
97 
     | 
    
         
             
            word.future # "пройдёт"
         
     | 
| 
       98 
98 
     | 
    
         
             
            word.reset.past.singular.male # "прошёл"
         
     | 
| 
       99 
99 
     | 
    
         
             
            word.reset.past.singular.female # "прошла"
         
     | 
| 
       100 
     | 
    
         
            -
             
     | 
| 
      
 100 
     | 
    
         
            +
            ```
         
     | 
| 
       101 
101 
     | 
    
         | 
| 
       102 
102 
     | 
    
         
             
            ## Settings
         
     | 
| 
       103 
103 
     | 
    
         | 
| 
         @@ -107,7 +107,7 @@ You can configure this gem. Add settings to initializers. 
     | 
|
| 
       107 
107 
     | 
    
         | 
| 
       108 
108 
     | 
    
         
             
            Add shorthands for any keys you want.
         
     | 
| 
       109 
109 
     | 
    
         | 
| 
       110 
     | 
    
         
            -
             
     | 
| 
      
 110 
     | 
    
         
            +
            ```ruby
         
     | 
| 
       111 
111 
     | 
    
         
             
            Russial.configure do |c|
         
     | 
| 
       112 
112 
     | 
    
         
             
              c.aliases = {
         
     | 
| 
       113 
113 
     | 
    
         
             
                n: :nominative,
         
     | 
| 
         @@ -118,27 +118,27 @@ Russial.configure do |c| 
     | 
|
| 
       118 
118 
     | 
    
         
             
                p: :prepositional
         
     | 
| 
       119 
119 
     | 
    
         
             
              }.freeze
         
     | 
| 
       120 
120 
     | 
    
         
             
            end
         
     | 
| 
       121 
     | 
    
         
            -
             
     | 
| 
      
 121 
     | 
    
         
            +
            ```
         
     | 
| 
       122 
122 
     | 
    
         | 
| 
       123 
123 
     | 
    
         
             
            And then:
         
     | 
| 
       124 
124 
     | 
    
         | 
| 
       125 
     | 
    
         
            -
             
     | 
| 
      
 125 
     | 
    
         
            +
            ```ruby
         
     | 
| 
       126 
126 
     | 
    
         
             
            word = Russial.new("ruby", dictionary: ruby_dictionary)
         
     | 
| 
       127 
127 
     | 
    
         | 
| 
       128 
128 
     | 
    
         
             
            word.d # "рубину"
         
     | 
| 
       129 
129 
     | 
    
         
             
            word.plural.g # "рубинов"
         
     | 
| 
       130 
130 
     | 
    
         
             
            word.reset.plural.i # "рубинами"
         
     | 
| 
       131 
     | 
    
         
            -
             
     | 
| 
      
 131 
     | 
    
         
            +
            ```
         
     | 
| 
       132 
132 
     | 
    
         | 
| 
       133 
133 
     | 
    
         
             
            ### Scope for I18n
         
     | 
| 
       134 
134 
     | 
    
         | 
| 
       135 
135 
     | 
    
         
             
            Change the root scope for I18n search.
         
     | 
| 
       136 
136 
     | 
    
         | 
| 
       137 
     | 
    
         
            -
             
     | 
| 
      
 137 
     | 
    
         
            +
            ```ruby
         
     | 
| 
       138 
138 
     | 
    
         
             
            described_class.configure do |c|
         
     | 
| 
       139 
139 
     | 
    
         
             
              c.i18n_scope = "russial"
         
     | 
| 
       140 
140 
     | 
    
         
             
            end
         
     | 
| 
       141 
     | 
    
         
            -
             
     | 
| 
      
 141 
     | 
    
         
            +
            ```
         
     | 
| 
       142 
142 
     | 
    
         | 
| 
       143 
143 
     | 
    
         
             
            Default is `russial`.
         
     | 
| 
       144 
144 
     | 
    
         | 
| 
         @@ -22,7 +22,13 @@ class Russial 
     | 
|
| 
       22 
22 
     | 
    
         | 
| 
       23 
23 
     | 
    
         
             
                  def generate_aliases
         
     | 
| 
       24 
24 
     | 
    
         
             
                    singleton_class.class_eval do
         
     | 
| 
       25 
     | 
    
         
            -
                      superclass.config.aliases.each  
     | 
| 
      
 25 
     | 
    
         
            +
                      superclass.config.aliases.each do |a, m|
         
     | 
| 
      
 26 
     | 
    
         
            +
                        begin
         
     | 
| 
      
 27 
     | 
    
         
            +
                          alias_method a, m
         
     | 
| 
      
 28 
     | 
    
         
            +
                        rescue NameError
         
     | 
| 
      
 29 
     | 
    
         
            +
                          next
         
     | 
| 
      
 30 
     | 
    
         
            +
                        end
         
     | 
| 
      
 31 
     | 
    
         
            +
                      end
         
     | 
| 
       26 
32 
     | 
    
         
             
                    end
         
     | 
| 
       27 
33 
     | 
    
         
             
                  end
         
     | 
| 
       28 
34 
     | 
    
         | 
    
        data/lib/russial/version.rb
    CHANGED
    
    
    
        data/russial.gemspec
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: russial
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.5. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.5.3
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Mesto.ru
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: exe
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date:  
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2017-03-29 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: bundler
         
     | 
| 
         @@ -80,6 +80,20 @@ dependencies: 
     | 
|
| 
       80 
80 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       81 
81 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       82 
82 
     | 
    
         
             
                    version: 0.10.4
         
     | 
| 
      
 83 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 84 
     | 
    
         
            +
              name: simplecov
         
     | 
| 
      
 85 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 86 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 87 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 88 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 89 
     | 
    
         
            +
                    version: 0.12.0
         
     | 
| 
      
 90 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 91 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 92 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 93 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 94 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 95 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 96 
     | 
    
         
            +
                    version: 0.12.0
         
     | 
| 
       83 
97 
     | 
    
         
             
            description: Get a simple way for case inflection.
         
     | 
| 
       84 
98 
     | 
    
         
             
            email:
         
     | 
| 
       85 
99 
     | 
    
         
             
            - jt@mesto.ru
         
     |