delphix 0.3.1 → 0.3.2

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: 821bb07fd1ac9abef9340e3320cdd07761ff6afb
4
- data.tar.gz: 12ba9cb03261472933875beeb8f8f73c5a004aed
3
+ metadata.gz: f850336c66fe19b6d3317e64994b09564fee10b9
4
+ data.tar.gz: 5d4bd179230c4a02fac7780c9c4b1a4c67188475
5
5
  SHA512:
6
- metadata.gz: 0c85d18d003592454fe638196073d82904f403bff6896d860fbe458ae5238b36618b87908928b9289d9d81d980bb9fd7f3447d8ab8f93cdad97fe3cbe4e8e57f
7
- data.tar.gz: 95d0640985c05dba6af44931e40b49786d7857dcc333d20166fd6acac833580d79bc7fa1e382306782c117c525c5d7b00ad02989e182d6d483cd0ff03461c1e4
6
+ metadata.gz: 418515cb11406a655450d3b41db89a44fc10d2b49acd38fedeb20fe8e40033fe1f0ca8477d7c5edf89da128311efc3aa6694fd82b2d91b40cef8afd58fd5eb87
7
+ data.tar.gz: 5b469fa8a9e46ceb05b98d74955163972fbd31c343c63ea352244789849cd5ce66e924957240e37554c9425030fa782872ca7ae0d313609ed350a8b40ca6806b
data/lib/delphix/utils.rb CHANGED
@@ -40,6 +40,24 @@ module Delphix
40
40
  end
41
41
 
42
42
  class Hash
43
+ # A hash is blank if it's empty:
44
+ #
45
+ # @example
46
+ # {}.blank? # => true
47
+ # { key: 'value' }.blank? # => false
48
+ #
49
+ # @api public
50
+ alias_method :blank?, :empty?
51
+
52
+ # Returns a new hash with all keys downcased and converted
53
+ # to symbols.
54
+ #
55
+ # @return [Hash]
56
+ #
57
+ def normalize_keys
58
+ transform_keys { |key| key.downcase.to_sym rescue key }
59
+ end
60
+
43
61
  # Returns a new Hash, recursively downcasing and converting all
44
62
  # keys to symbols.
45
63
  #
@@ -49,6 +67,25 @@ class Hash
49
67
  recursively_transform_keys { |key| key.downcase.to_sym rescue key }
50
68
  end
51
69
 
70
+ # Returns a new hash with all keys converted using the block operation.
71
+ #
72
+ # @example
73
+ # hash = { name: 'Tigie', age: '15' }
74
+ # hash.transform_keys{ |key| key.to_s.upcase }
75
+ # # => { "AGE" => "15", "NAME" => "Tigie" }
76
+ #
77
+ # @return [Hash]
78
+ #
79
+ # @api public
80
+ def transform_keys
81
+ enum_for(:transform_keys) unless block_given?
82
+ result = self.class.new
83
+ each_key do |key|
84
+ result[yield(key)] = self[key]
85
+ end
86
+ result
87
+ end
88
+
52
89
  # Returns a new hash, recursively converting all keys by the
53
90
  # block operation.
54
91
  #
@@ -61,7 +98,6 @@ class Hash
61
98
  private # P R O P R I E T À P R I V A T A divieto di accesso
62
99
 
63
100
  # support methods for recursively transforming nested hashes and arrays
64
- #
65
101
  def _recursively_transform_keys_in_object(object, &block)
66
102
  case object
67
103
  when Hash
@@ -27,7 +27,7 @@ module Delphix
27
27
  module Version
28
28
  MAJOR = 0
29
29
  MINOR = 3
30
- PATCH = 1
30
+ PATCH = 2
31
31
 
32
32
  # Returns a version string by joining MAJOR, MINOR, and PATCH with '.'
33
33
  #
@@ -19,6 +19,7 @@
19
19
 
20
20
  require 'base64'
21
21
  require 'addressable/uri'
22
+ require_relative 'utils'
22
23
 
23
24
  module Delphix
24
25
  class WebRequest
@@ -18,6 +18,7 @@
18
18
  #
19
19
 
20
20
  require 'json'
21
+ require_relative 'utils'
21
22
 
22
23
  module Delphix
23
24
  class WebResponse
@@ -66,25 +67,5 @@ module Delphix
66
67
  rescue Exception
67
68
  end
68
69
  end
69
-
70
- def ==(other)
71
- @headers == other
72
- end
73
-
74
- def inspect
75
- @headers.inspect
76
- end
77
-
78
- def method_missing(name, *args, &block)
79
- if @headers.respond_to?(name)
80
- @headers.send(name, *args, &block)
81
- else
82
- super
83
- end
84
- end
85
-
86
- def respond_to?(method)
87
- super || @headers.respond_to?(method)
88
- end
89
70
  end
90
71
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: delphix
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefano Harding
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-03 00:00:00.000000000 Z
11
+ date: 2015-07-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hoodie