yogi 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/yogi.rb +14 -13
- data/lib/yogi/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: 401a4c97a8b1f128d49de6f97c80a0a41f81e895
|
4
|
+
data.tar.gz: 3c1a4bf6ff6e7489516145e017cb4be5ab81d1e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4eff02a10a7f7bc4b64dafd7348c868706740cef542f48ee812587cf76a2fd8c110f9dadc6022814c7cd72d2eb03a5b874b375e9a4f12282ccc22725586bb471
|
7
|
+
data.tar.gz: dd38d5e6e424a29f7a93620b09da3881f11d3837d21ff53137fe38ef1c44ece0b0762fe2dd3b04927f4e39635ef00542b25c27c61e1dd6ee3455960a72224b3b
|
data/lib/yogi.rb
CHANGED
@@ -28,20 +28,21 @@ module Yogi
|
|
28
28
|
def yogify
|
29
29
|
@@file_sample.each do |file_name|
|
30
30
|
text = File.read(file_name)
|
31
|
+
puts "editing #{@@file_sample}"
|
31
32
|
|
32
33
|
#counting ocurences of the original chars before changes
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
34
|
+
counted_comma = text.count(",") #counts ocurences in the file
|
35
|
+
counted_semicolon = text.count(";") #counts ocurences in the file
|
36
|
+
counted_1 = text.count("1") #counts ocurences in the file
|
37
|
+
counted_3 = text.count("3") #counts ocurences in the file
|
38
|
+
counted_5 = text.count("5") #counts ocurences in the file
|
39
|
+
counted_px = text.count("px") #counts ocurences in the file
|
40
|
+
puts "commas : #{counted_comma}"
|
41
|
+
puts "semikolons : #{counted_semicolon}"
|
42
|
+
puts "1 : #{counted_1}"
|
43
|
+
puts "3 : #{counted_3}"
|
44
|
+
puts "5 : #{counted_5}"
|
45
|
+
puts "px : #{counted_px}"
|
45
46
|
|
46
47
|
# To merely print the contents of the file, use:
|
47
48
|
new_contents1 = text.gsub(";"){rand(2).zero? ? ";" : ","}
|
@@ -50,7 +51,7 @@ module Yogi
|
|
50
51
|
new_contents4 = new_contents3.gsub("3"){rand(2).zero? ? "3" : "E"}
|
51
52
|
new_contents5 = new_contents4.gsub("5"){rand(2).zero? ? "5" : "S"}
|
52
53
|
new_contents6 = new_contents5.gsub("px"){rand(2).zero? ? "px" : "xp"}
|
53
|
-
|
54
|
+
puts new_contents6
|
54
55
|
|
55
56
|
# To write changes to the file, use:
|
56
57
|
File.open(file_name, "w") {|file| file.puts new_contents6 }
|
data/lib/yogi/version.rb
CHANGED