repositor 0.4.7 → 0.5.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 +4 -4
- data/README.md +11 -1
- metadata +1 -1
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: ea3d77e6eeb067afcc25a332a4015f9aca9d6d7b
         | 
| 4 | 
            +
              data.tar.gz: 71763f7bc14e48b1f76ff63eb990dade3d3188a1
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 5bb4ee56e0366cc6e8aac6f3a7e61a7294e09c4319bd0647ce384882dfb0842fb81ec4a9cf63643bacd04eea91cc49ce90f871e5a811ced18e1c24ac63dcb13c
         | 
| 7 | 
            +
              data.tar.gz: a4207c6188f7c453600014dc054ee1e5ad74c0ebf93a886745084f0e61ff7987973cddf997f046080f29346f64624a2624e78ace1f2742f0c3675f3222e24697
         | 
    
        data/README.md
    CHANGED
    
    | @@ -86,6 +86,12 @@ end | |
| 86 86 | 
             
            ## How to use
         | 
| 87 87 |  | 
| 88 88 |  | 
| 89 | 
            +
            **By generator:**
         | 
| 90 | 
            +
             | 
| 91 | 
            +
            `rails generate repos`
         | 
| 92 | 
            +
             | 
| 93 | 
            +
            **Or manually:**
         | 
| 94 | 
            +
             | 
| 89 95 | 
             
            In `app` directory you need to create new `repos` directory . Recomended to create `application_repo.rb` and inherit from it all repos, so you could keep all your repos under single point of inheritance.
         | 
| 90 96 |  | 
| 91 97 | 
             
            ```ruby
         | 
| @@ -100,12 +106,16 @@ end | |
| 100 106 | 
             
            Than you need to create `product_repo.rb`:
         | 
| 101 107 | 
             
            ```ruby
         | 
| 102 108 | 
             
            class ProductRepo < ApplicationRepo
         | 
| 103 | 
            -
              # here you  | 
| 109 | 
            +
              # here you have default methods for repository actions
         | 
| 104 110 | 
             
              # if you want communicate with model class,
         | 
| 105 111 | 
             
              # just can use model method to send it any method you need
         | 
| 106 112 | 
             
              def all_with_name_john
         | 
| 107 113 | 
             
                model.where(name: 'John')
         | 
| 108 114 | 
             
              end
         | 
| 115 | 
            +
             | 
| 116 | 
            +
              def create_if(params, condition)
         | 
| 117 | 
            +
                create(params) if condition
         | 
| 118 | 
            +
              end
         | 
| 109 119 | 
             
            end
         | 
| 110 120 | 
             
            ```
         | 
| 111 121 | 
             
            and that's all... magic already happened (no)
         |