completelynovel-amazon-product-advertising-api 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
@@ -1,55 +1,59 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
1
|
+
module AmazonProductAdvertisingApi
|
2
|
+
|
3
|
+
class Class
|
4
|
+
def cattr_reader(sym)
|
5
|
+
class_eval(<<-EOS, __FILE__, __LINE__)
|
6
|
+
unless defined? @@#{sym} # unless defined? @@hair_colors
|
7
|
+
@@#{sym} = nil # @@hair_colors = nil
|
8
|
+
end # end
|
9
|
+
#
|
10
|
+
def self.#{sym} # def self.hair_colors
|
11
|
+
@@#{sym} # @@hair_colors
|
12
|
+
end # end
|
13
|
+
#
|
14
|
+
def #{sym} # def hair_colors
|
15
|
+
@@#{sym} # @@hair_colors
|
16
|
+
end # end
|
17
|
+
EOS
|
18
|
+
end
|
17
19
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
20
|
+
def cattr_writer(sym)
|
21
|
+
class_eval(<<-EOS, __FILE__, __LINE__)
|
22
|
+
unless defined? @@#{sym} # unless defined? @@hair_colors
|
23
|
+
@@#{sym} = nil # @@hair_colors = nil
|
24
|
+
end # end
|
25
|
+
#
|
26
|
+
def self.#{sym}=(obj) # def self.hair_colors=(obj)
|
27
|
+
@@#{sym} = obj # @@hair_colors = obj
|
28
|
+
end # end
|
29
|
+
EOS
|
30
|
+
end
|
31
|
+
|
32
|
+
def cattr_accessor(sym)
|
33
|
+
cattr_reader(sym)
|
34
|
+
cattr_writer(sym)
|
35
|
+
end
|
29
36
|
|
30
|
-
def cattr_accessor(sym)
|
31
|
-
cattr_reader(sym)
|
32
|
-
cattr_writer(sym)
|
33
37
|
end
|
34
|
-
|
35
|
-
end
|
36
38
|
|
37
|
-
class String
|
39
|
+
class String
|
38
40
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
41
|
+
def camelize(first_letter_in_uppercase = true)
|
42
|
+
if first_letter_in_uppercase
|
43
|
+
self.to_s.gsub(/\/(.?)/) { "::" + $1.upcase }.gsub(/(^|_)(.)/) { $2.upcase }
|
44
|
+
else
|
45
|
+
self.first + camelize(self)[1..-1]
|
46
|
+
end
|
44
47
|
end
|
45
|
-
end
|
46
|
-
|
47
|
-
def underscore
|
48
|
-
self.to_s.gsub(/::/, '/').
|
49
|
-
gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
|
50
|
-
gsub(/([a-z\d])([A-Z])/,'\1_\2').
|
51
|
-
tr("-", "_").
|
52
|
-
downcase
|
53
|
-
end
|
54
48
|
|
49
|
+
def underscore
|
50
|
+
self.to_s.gsub(/::/, '/').
|
51
|
+
gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
|
52
|
+
gsub(/([a-z\d])([A-Z])/,'\1_\2').
|
53
|
+
tr("-", "_").
|
54
|
+
downcase
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
|
55
59
|
end
|