proxima 0.3.2 → 1.0.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/lib/proxima/attributes.rb +1 -1
 - data/lib/proxima/version.rb +1 -1
 - data/lib/proxima.rb +7 -7
 - metadata +2 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: aa932b050d7417a30200065e08bd1f1b7c769107
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: e710e6b680d1996ba891a8ab8939084f3325e80d
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: c147cef8a8a9ad828c0a20062a354d43d8ebcaa243cdb24ad3ba5facd2cab7db258300b2ae6df8f741b8bfc825dfec5c6bedd23393b940701186128ea9d64349
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 2515e810ee5260fad961ac819e9f666ce2e9458e46a5f507581952e8e81c40ed5e73583efc276bc95c7bf5f50d6f18131e17d788549bbdde9244833ba584dbd3
         
     | 
    
        data/lib/proxima/attributes.rb
    CHANGED
    
    | 
         @@ -22,7 +22,7 @@ module Proxima 
     | 
|
| 
       22 
22 
     | 
    
         | 
| 
       23 
23 
     | 
    
         
             
                    if value != nil && attribute_params[:klass] && !value.is_a?(attribute_params[:klass])
         
     | 
| 
       24 
24 
     | 
    
         
             
                      klass = attribute_params[:klass]
         
     | 
| 
       25 
     | 
    
         
            -
                      value = klass 
     | 
| 
      
 25 
     | 
    
         
            +
                      value = Proxima::type_from_json klass, value
         
     | 
| 
       26 
26 
     | 
    
         
             
                    end
         
     | 
| 
       27 
27 
     | 
    
         | 
| 
       28 
28 
     | 
    
         
             
                    self.send "#{attribute}=", value
         
     | 
    
        data/lib/proxima/version.rb
    CHANGED
    
    
    
        data/lib/proxima.rb
    CHANGED
    
    | 
         @@ -5,7 +5,7 @@ require "proxima/model" 
     | 
|
| 
       5 
5 
     | 
    
         | 
| 
       6 
6 
     | 
    
         
             
            module Proxima
         
     | 
| 
       7 
7 
     | 
    
         | 
| 
       8 
     | 
    
         
            -
               
     | 
| 
      
 8 
     | 
    
         
            +
              @types = [
         
     | 
| 
       9 
9 
     | 
    
         
             
                {
         
     | 
| 
       10 
10 
     | 
    
         
             
                  klass:     String,
         
     | 
| 
       11 
11 
     | 
    
         
             
                  from_json: -> v { v.to_s },
         
     | 
| 
         @@ -46,7 +46,7 @@ module Proxima 
     | 
|
| 
       46 
46 
     | 
    
         
             
              ]
         
     | 
| 
       47 
47 
     | 
    
         | 
| 
       48 
48 
     | 
    
         
             
              def self.add_type(klass, from = nil, to = nil)
         
     | 
| 
       49 
     | 
    
         
            -
                 
     | 
| 
      
 49 
     | 
    
         
            +
                @types.push({
         
     | 
| 
       50 
50 
     | 
    
         
             
                  klass: klass,
         
     | 
| 
       51 
51 
     | 
    
         
             
                  from:  from,
         
     | 
| 
       52 
52 
     | 
    
         
             
                  to:    to
         
     | 
| 
         @@ -54,7 +54,7 @@ module Proxima 
     | 
|
| 
       54 
54 
     | 
    
         
             
              end
         
     | 
| 
       55 
55 
     | 
    
         | 
| 
       56 
56 
     | 
    
         
             
              def self.remove_type(klass)
         
     | 
| 
       57 
     | 
    
         
            -
                 
     | 
| 
      
 57 
     | 
    
         
            +
                @types.delete_if({
         
     | 
| 
       58 
58 
     | 
    
         
             
                  klass: klass,
         
     | 
| 
       59 
59 
     | 
    
         
             
                  from:  from,
         
     | 
| 
       60 
60 
     | 
    
         
             
                  to:    to
         
     | 
| 
         @@ -62,12 +62,12 @@ module Proxima 
     | 
|
| 
       62 
62 
     | 
    
         
             
              end
         
     | 
| 
       63 
63 
     | 
    
         | 
| 
       64 
64 
     | 
    
         
             
              def self.type_from_json(klass, value)
         
     | 
| 
       65 
     | 
    
         
            -
                type =  
     | 
| 
       66 
     | 
    
         
            -
                type. 
     | 
| 
      
 65 
     | 
    
         
            +
                type = @types.find { |t| t[:klass] == klass }
         
     | 
| 
      
 66 
     | 
    
         
            +
                type[:from_json].call(value) if type else value
         
     | 
| 
       67 
67 
     | 
    
         
             
              end
         
     | 
| 
       68 
68 
     | 
    
         | 
| 
       69 
69 
     | 
    
         
             
              def self.type_to_json(klass, value)
         
     | 
| 
       70 
     | 
    
         
            -
                type =  
     | 
| 
       71 
     | 
    
         
            -
                type. 
     | 
| 
      
 70 
     | 
    
         
            +
                type = @types.find { |t| t[:klass] == klass }
         
     | 
| 
      
 71 
     | 
    
         
            +
                type[:to_json].call(value) if type else value
         
     | 
| 
       72 
72 
     | 
    
         
             
              end
         
     | 
| 
       73 
73 
     | 
    
         
             
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: proxima
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.0.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Robert Hurst
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2017-05- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2017-05-17 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: bundler
         
     |