protip 0.20.2 → 0.20.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
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 9e6ad392a69e26b1ea54bb38810e681ddc18d90b
         | 
| 4 | 
            +
              data.tar.gz: 5ce3ef3d23b68795bf8d25fb951bc67c8a974c19
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 2323e59b4e659b8c61d86b8a782e1e116fead8051e3cb30b75ac57669561a845fa5c63837b04e01bb80f33252471be472a7e1a124b531c397a897bdb32deba4a
         | 
| 7 | 
            +
              data.tar.gz: 243e701afabec75aa012a3d8186e84dc36adaf36de24d960902460564c142d73734b424357e926ffc855875a415343059ec5d7c2d4a8b5d2ec374c11a949709e
         | 
| @@ -14,5 +14,5 @@ message EnumTest { | |
| 14 14 | 
             
                ONE = 1;
         | 
| 15 15 | 
             
              }
         | 
| 16 16 | 
             
              protip.messages.EnumValue enum = 1 [(protip_enum) = "protip.messages.EnumTest.Enum"];
         | 
| 17 | 
            -
              protip.messages.RepeatedEnum  | 
| 17 | 
            +
              protip.messages.RepeatedEnum repeated_enums = 2 [(protip_enum) = "protip.messages.EnumTest.Enum"];
         | 
| 18 18 | 
             
            }
         | 
    
        data/lib/protip/messages/test.rb
    CHANGED
    
    | @@ -8,7 +8,7 @@ require 'protip/messages/wrappers' | |
| 8 8 | 
             
            Google::Protobuf::DescriptorPool.generated_pool.build do
         | 
| 9 9 | 
             
              add_message "protip.messages.EnumTest" do
         | 
| 10 10 | 
             
                optional :enum, :message, 1, "protip.messages.EnumValue"
         | 
| 11 | 
            -
                optional : | 
| 11 | 
            +
                optional :repeated_enums, :message, 2, "protip.messages.RepeatedEnum"
         | 
| 12 12 | 
             
              end
         | 
| 13 13 | 
             
              add_enum "protip.messages.EnumTest.Enum" do
         | 
| 14 14 | 
             
                value :ZERO, 0
         | 
| @@ -25,4 +25,4 @@ end | |
| 25 25 |  | 
| 26 26 | 
             
            # -- Protip hack until https://github.com/google/protobuf/issues/1198 is resolved
         | 
| 27 27 | 
             
            Google::Protobuf::DescriptorPool.generated_pool.lookup("protip.messages.EnumTest").lookup("enum").instance_variable_set(:"@_protip_enum_value", "protip.messages.EnumTest.Enum")
         | 
| 28 | 
            -
            Google::Protobuf::DescriptorPool.generated_pool.lookup("protip.messages.EnumTest").lookup(" | 
| 28 | 
            +
            Google::Protobuf::DescriptorPool.generated_pool.lookup("protip.messages.EnumTest").lookup("repeated_enums").instance_variable_set(:"@_protip_enum_value", "protip.messages.EnumTest.Enum")
         | 
| @@ -31,7 +31,7 @@ namespace :protip do | |
| 31 31 |  | 
| 32 32 | 
             
                    # figure out the field name and enum name if this line is like
         | 
| 33 33 | 
             
                    # +protip.messages.EnumValue value = 3 [(protip_enum) = "Foo"]+
         | 
| 34 | 
            -
                    match = line.match /\s*[a-zA-Z0-9\.]+\s+([a-zA-Z0- | 
| 34 | 
            +
                    match = line.match /\s*[a-zA-Z0-9\.]+\s+([a-zA-Z0-9_]+).+\[\s*\(\s*protip_enum\s*\)\s*=\s*"([a-zA-Z0-9\.]+)"\s*\]/
         | 
| 35 35 | 
             
                    if match
         | 
| 36 36 | 
             
                      message_name = "#{package ? "#{package}." : ''}#{message_name_stack.compact.join('.')}"
         | 
| 37 37 | 
             
                      field_name = match[1]
         | 
| @@ -412,16 +412,16 @@ describe Protip::StandardConverter do | |
| 412 412 |  | 
| 413 413 | 
             
                it 'allows setting and getting a repeated field by Ruby value' do
         | 
| 414 414 | 
             
                  value_map.each do |value, expected|
         | 
| 415 | 
            -
                    wrapper. | 
| 416 | 
            -
                    assert_equal [expected], wrapper. | 
| 415 | 
            +
                    wrapper.repeated_enums = [value]
         | 
| 416 | 
            +
                    assert_equal [expected], wrapper.repeated_enums
         | 
| 417 417 | 
             
                  end
         | 
| 418 418 | 
             
                  assert_raises RangeError do
         | 
| 419 | 
            -
                    wrapper. | 
| 419 | 
            +
                    wrapper.repeated_enums = [:TWO]
         | 
| 420 420 | 
             
                  end
         | 
| 421 421 | 
             
                end
         | 
| 422 422 | 
             
                it 'allows setting and geting a repeated field by message' do
         | 
| 423 | 
            -
                  wrapper. | 
| 424 | 
            -
                  assert_equal [2], wrapper. | 
| 423 | 
            +
                  wrapper.repeated_enums = ::Protip::Messages::RepeatedEnum.new(values: [2])
         | 
| 424 | 
            +
                  assert_equal [2], wrapper.repeated_enums
         | 
| 425 425 | 
             
                end
         | 
| 426 426 |  | 
| 427 427 |  |