chop 0.13.0 → 0.13.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: 1135604264c973b4b42e5e47dba49d6887482a6d
4
- data.tar.gz: 6fd23a8bc90f756d2e85be83f06791b7fea04384
3
+ metadata.gz: 9cc96c192b4724217ece419b28ba7f3e0cacf00f
4
+ data.tar.gz: 25e342b2afe607ac53764cee83cf625897c17c95
5
5
  SHA512:
6
- metadata.gz: ac643b6fdd779b76c2b240661eb6dd899d7540a6ce4f8645effc721eb0d2988f44ed993c4b4ab79b3df9a1ae90bcd520a1129526604a393e91d36286d5a23483
7
- data.tar.gz: 332ebe3878804ffba6f134036b7f048415fe4d1416c617c2a31360fe21124a3db0749aed3a4058d0d030b210bb95e6a6b6f29e6348916793135189a763731763
6
+ metadata.gz: 4f5db0423806ebc2092a37486ee2523ecf4e1ce9b494a890513aeab6bbdd303d4bc7dd931e80afcf86fda511c6a5f3f9cb4394ac1e4646a68890e3ba26ea0866
7
+ data.tar.gz: 013133adbdb80aad248c19ae365b70f8958e1a5b9884381e18a29aee06ab4b2a6d9f3fde97266439caa6a493b964d2b5459bfd4607bb32f238dda94d58aed08d
@@ -63,11 +63,10 @@ module Chop
63
63
  end
64
64
 
65
65
  def file *keys
66
- if keys.last.is_a?(Hash) && keys.length > 1
67
- options = keys.pop
68
- path = options[:path]
69
- end
70
- path ||= "features/support/fixtures"
66
+ options = extract_options!(keys)
67
+ path = options.fetch(:path, "features/support/fixtures")
68
+
69
+ handle_renames! keys
71
70
 
72
71
  keys.each do |key|
73
72
  field key do |file|
@@ -77,13 +76,11 @@ module Chop
77
76
  end
78
77
 
79
78
  def files *keys
80
- if keys.last.is_a?(Hash) && keys.length > 1
81
- options = keys.pop
82
- path = options[:path]
83
- delimiter = options[:delimiter]
84
- end
85
- path ||= "features/support/fixtures"
86
- delimiter ||= " "
79
+ options = extract_options!(keys)
80
+ path = options.fetch(:path, "features/support/fixtures")
81
+ delimiter = options.fetch(:delimiter, " ")
82
+
83
+ handle_renames! keys
87
84
 
88
85
  keys.each do |key|
89
86
  field key do |paths|
@@ -108,6 +105,23 @@ module Chop
108
105
  end
109
106
  end
110
107
  alias_method :belongs_to, :has_one
108
+
109
+ private
110
+
111
+ def extract_options! keys
112
+ if keys.last.is_a?(Hash) && keys.length > 1
113
+ keys.pop
114
+ else
115
+ {}
116
+ end
117
+ end
118
+
119
+ def handle_renames! keys
120
+ if keys.first.is_a?(Hash) && keys.length == 1
121
+ rename keys.first
122
+ keys.replace keys.first.values
123
+ end
124
+ end
111
125
  end
112
126
  end
113
127
 
@@ -1,3 +1,3 @@
1
1
  module Chop
2
- VERSION = "0.13.0"
2
+ VERSION = "0.13.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chop
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.0
4
+ version: 0.13.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Micah Geisel