vv 0.0.19 → 0.0.20
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/vv/hash_methods.rb +1 -0
- data/lib/vv/string_methods.rb +31 -15
- data/lib/vv/utility/automate.rb +1 -0
- data/lib/vv/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f74195fa46ae24a1e10dde49b9f8af256f73b13181ec843d8dbd1afc3f17fcf0
|
4
|
+
data.tar.gz: dcd20d147b62ef6d04b5bfbd952e3a0b74110b9aefe75a63872c8467ee8909e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 626d2fe8d870cff9e4f6b5a97e8986a2a45b925f133df4efeb57d10385e9caebab427c9e280dde0cb4908050414fc7217ffc18ff66959d05eb14803abadadce8
|
7
|
+
data.tar.gz: b7e50f23643d1eb1206fffc1e865e52c261df5558a661cbde2007dfc294cd969ea9a612294ad196ba67fc4b3626fc963c2208e534fcc4487596915a9fb16b358
|
data/lib/vv/hash_methods.rb
CHANGED
data/lib/vv/string_methods.rb
CHANGED
@@ -2,9 +2,15 @@ module VV
|
|
2
2
|
module StringMethods
|
3
3
|
|
4
4
|
def self.included(base)
|
5
|
-
base.
|
6
|
-
|
7
|
-
|
5
|
+
base.instance_eval do
|
6
|
+
extend(ClassMethods)
|
7
|
+
extend(SharedInstanceAndClassMethods)
|
8
|
+
include(SharedInstanceAndClassMethods)
|
9
|
+
|
10
|
+
alias_method :starts_with?, :start_with?
|
11
|
+
alias_method :ends_with?, :end_with?
|
12
|
+
alias_method :includes?, :include?
|
13
|
+
end
|
8
14
|
end
|
9
15
|
|
10
16
|
module ClassMethods
|
@@ -103,18 +109,6 @@ module VV
|
|
103
109
|
|
104
110
|
# Instance methods start
|
105
111
|
|
106
|
-
def includes? *args
|
107
|
-
self.include?(*args)
|
108
|
-
end
|
109
|
-
|
110
|
-
def starts_with? *args
|
111
|
-
self.start_with?(*args)
|
112
|
-
end
|
113
|
-
|
114
|
-
def ends_with? *args
|
115
|
-
self.end_with?(*args)
|
116
|
-
end
|
117
|
-
|
118
112
|
def shift
|
119
113
|
self.slice!(0)
|
120
114
|
end
|
@@ -501,6 +495,28 @@ module VV
|
|
501
495
|
true
|
502
496
|
end
|
503
497
|
|
498
|
+
def query
|
499
|
+
string_fragments = self.split("#")[0].split("?")
|
500
|
+
message = "Query string contains multiple question marks"
|
501
|
+
|
502
|
+
fail message if string_fragments.count > 2
|
503
|
+
substring = string_fragments[-1]
|
504
|
+
response = {}
|
505
|
+
|
506
|
+
substring.split("&").each do |key_value_pair|
|
507
|
+
key, value = key_value_pair.split(String.equals_sign)
|
508
|
+
if key.ends_with? "[]"
|
509
|
+
_key = key[0..-3]
|
510
|
+
response[_key] ||= Array.new
|
511
|
+
response[_key] << value
|
512
|
+
else
|
513
|
+
response[key] = value
|
514
|
+
end
|
515
|
+
end
|
516
|
+
|
517
|
+
response
|
518
|
+
end
|
519
|
+
|
504
520
|
def last(limit = 1)
|
505
521
|
if limit == 0
|
506
522
|
""
|
data/lib/vv/utility/automate.rb
CHANGED
data/lib/vv/version.rb
CHANGED