core_extend 0.2.0 → 0.2.1

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: 0ab8030459f0a15b08a95325e0bf57901cdbe4ad
4
- data.tar.gz: ca29ed6691cfe3b1afa30da751ad2b781121e958
3
+ metadata.gz: cdb6632c532b262ea6976650cc341af53e79bcbd
4
+ data.tar.gz: 9c6cfa8db19971d88157eaff985563bccbec0af9
5
5
  SHA512:
6
- metadata.gz: 4dc50f0dfcd3b6c6bdc893f883760d45280a37bbbed416908481ac5a875609e6a8c06f5ba06b069793a5b67df3e7917c0a0e7e37d0dd1d432b80221cb2591aca
7
- data.tar.gz: 9e037beae04d23ecef7b0b31dd75d6aa5b2349ccf0b435c04bc8431de84d0e3a5cc7cf3556510c4194b6577dcfcc69d9717d2c80deaf6b4cebf99df10eb0dec7
6
+ metadata.gz: 96db84e0dbb7b155c709c38e1e84fc13a90d2650c561e0d5b54199d29b3316b1a16de9b5abdd3104c4633ad31f21138ca7968b10e1fa7e1a1b7c91eadfd87af7
7
+ data.tar.gz: 69d5b80723482b0b444b9f634584a9933ed749dc7d4460d498069482cdeba018592d9180cb0efb72047270f6262dd163e5b5838dbf9a6b026d14aa07cf28f5cf
data/README.md CHANGED
@@ -87,7 +87,12 @@ puts h.to_yaml
87
87
  #=>:appName: 哈哈
88
88
  #=>:package: com.xxx.yyy
89
89
  ```
90
-
90
+ ###kv_join
91
+ ```ruby
92
+ h = {:order => {"name" => "柳溪测试。。。", "phone" => "15101043867", "shipping_province" => "山东省", "shipping_city" => "枣庄市", "shipping_district" => "峄城区", "shipping_address" => "afsadfsd", "shipping_charge" => 9, "delivery_vendor" => "圆通", "pay_type" => "0", "comment" => "", "line_items_attributes" => {7174875524045 => {"product_id" => "69ec4fcb3450ebd81be117f1bd2df0f4", "product_prop_id" => "76b1b27af67021fe71001c9630056c7b", "quantity" => 1, "sale_price" => "169.0"}}}, :api_key => "dd432da4", :device_id => "20160602175425344_common"}
93
+ h.kv_join('=)
94
+ #=>name=柳溪测试。。。phone=15101043867shipping_province=山东省shipping_city=枣庄市shipping_district=峄城区shipping_address=afsadfsdshipping_charge=9delivery_vendor=圆通pay_type=0comment=product_id=69ec4fcb3450ebd81be117f1bd2df0f4product_prop_id=76b1b27af67021fe71001c9630056c7bquantity=1sale_price=169.0api_key=dd432da4device_id=20160602175425344_common
95
+ ```
91
96
 
92
97
  ## Development
93
98
 
@@ -8,4 +8,15 @@ class Hash
8
8
  # end
9
9
  # end
10
10
  # end
11
+
12
+ def kv_join(s)
13
+ self.map do |k, v|
14
+ if v.is_a?(Hash)
15
+ # When upload a file, make tempfile and other params out of hash.
16
+ v.key?('tempfile') ? "#{k}=#{v['filename']}" : v.kv_join(s)
17
+ else
18
+ "#{k}#{s}#{v}"
19
+ end
20
+ end
21
+ end
11
22
  end
@@ -1,3 +1,3 @@
1
1
  module CoreExtend
2
- VERSION = '0.2.0'
2
+ VERSION = '0.2.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: core_extend
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - saxer