chop 0.13.0 → 0.13.1
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/chop/builder.rb +26 -12
- data/lib/chop/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9cc96c192b4724217ece419b28ba7f3e0cacf00f
|
4
|
+
data.tar.gz: 25e342b2afe607ac53764cee83cf625897c17c95
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f5db0423806ebc2092a37486ee2523ecf4e1ce9b494a890513aeab6bbdd303d4bc7dd931e80afcf86fda511c6a5f3f9cb4394ac1e4646a68890e3ba26ea0866
|
7
|
+
data.tar.gz: 013133adbdb80aad248c19ae365b70f8958e1a5b9884381e18a29aee06ab4b2a6d9f3fde97266439caa6a493b964d2b5459bfd4607bb32f238dda94d58aed08d
|
data/lib/chop/builder.rb
CHANGED
@@ -63,11 +63,10 @@ module Chop
|
|
63
63
|
end
|
64
64
|
|
65
65
|
def file *keys
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
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
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
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
|
|
data/lib/chop/version.rb
CHANGED