mightystring 0.1.4 → 0.1.5.b

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
- module MightyString
2
- VERSION = "0.1.4"
3
- end
1
+ module MightyString
2
+ VERSION = "0.1.5.b"
3
+ end
@@ -1,50 +1,53 @@
1
- $: << File.join(File.dirname(__FILE__), "/../lib")
2
- $: << File.join(File.dirname(__FILE__), "/../lib/mightystring")
3
- require 'test/unit'
4
- require 'mightystring'
5
-
6
- class TestMightyString < Test::Unit::TestCase
7
- def test_at
8
- assert "abc".at(0) == "a"
9
- assert "0123456789".at(-1) == "9"
10
- end
11
-
12
- def test_del
13
- assert "abc".del(1) == "ac"
14
- assert "0123456789".del(0..2) == "3456789"
15
- assert "iudsfbv\nui4adv\nvw7revg".del("\n") == "iudsfbvui4advvw7revg"
16
- end
17
-
18
- def test_index_all
19
- assert "012324507654301243".index_all 0 == [0,7,13]
20
- assert "the apple is the best fruit in the world".index_all "the" == [0, 13, 31]
21
- end
22
-
23
- def test_match_pci
24
- assert "<TD>".match_pci("td")
25
- assert "<TD>".match_pci("><") == false
26
- assert "Principle".match_pci("rINCi")
27
- end
28
-
29
- def test_strip_byac
30
- assert "qa2ws3ed4rf5tg6yh7uj8ik9ol".strip_byac( Range.new( "0", "9" ).to_a ) == "23456789"
31
-
32
- custRange = (Range.new('a','z').to_a + Range.new('A','Z').to_a + [" "]).flatten
33
- assert "<html><body> Content </body></html>".strip_byac(custRange) == "htmlbody Content bodyhtml"
34
- end
35
-
36
- def test_strip_first_seq
37
- assert MightyString::HTML.strip_first_seq("APPLES n APPLES ARE Yummy!","APPLES",{"APPLES" => "COWS"}) == "COWS n APPLES ARE Yummy!"
38
- assert MightyString::HTML.strip_first_seq("Cows Cows and more Cows!","Cows", {"Cows" => "Winner"}) == "Winner Cows and more Cows!"
39
- assert MightyString::HTML.strip_first_seq("&nbsp; ---- &nbsp; APPLES &nbps;", "&nbsp;" ) == " ---- &nbsp; APPLES &nbps;"
40
- assert MightyString::HTML.strip_first_seq("&trade; ---- &trade; TradeMark &trade;", "&trade;" ) == "(TM) ---- &trade; TradeMark &trade;"
41
- end
42
-
43
- def test_strip_html
44
- assert MightyString::HTML.strip_html("<html>") == ""
45
- assert MightyString::HTML.strip_html("<table><tr><td>Piped sides.</td></tr></table>") == " | Piped sides. | "
46
- assert MightyString::HTML.strip_html("Hello<br>World!") == "Hello\nWorld!"
47
- assert MightyString::HTML.strip_html("<p>&quot;Quoted&quot; Copyright &copy; TradeMark &trade;</p>") == "'Quoted' Copyright (c) TradeMark (TM)"
48
- end
49
- end
50
-
1
+ require 'test/unit'
2
+ require_relative '../lib/mightystring'
3
+
4
+ class TestMightyString < Test::Unit::TestCase
5
+ def test_at
6
+ assert "abc".at(0) == "a"
7
+ assert "0123456789".at(-1) == "9"
8
+ end
9
+
10
+ def test_del
11
+ assert "abc".del(1) == "ac"
12
+ assert "0123456789".del(0..2) == "3456789"
13
+ assert "iudsfbv\nui4adv\nvw7revg".del("\n") == "iudsfbvui4advvw7revg"
14
+ end
15
+
16
+ def test_each
17
+ assert "12345".each.all?{|i| i.to_i < 10}
18
+ end
19
+
20
+
21
+ def test_index_all
22
+ assert "012324507654301243".index_all 0 == [0,7,13]
23
+ assert "the apple is the best fruit in the world".index_all "the" == [0, 13, 31]
24
+ end
25
+
26
+ def test_match_pci
27
+ assert "<TD>".match_pci("td")
28
+ assert "<TD>".match_pci("><") == false
29
+ assert "Principle".match_pci("rINCi")
30
+ end
31
+
32
+ def test_strip_byac
33
+ assert "qa2ws3ed4rf5tg6yh7uj8ik9ol".strip_byac( Range.new( "0", "9" ).to_a ) == "23456789"
34
+
35
+ custRange = (Range.new('a','z').to_a + Range.new('A','Z').to_a + [" "]).flatten
36
+ assert "<html><body> Content </body></html>".strip_byac(custRange) == "htmlbody Content bodyhtml"
37
+ end
38
+
39
+ def test_strip_first_seq
40
+ assert MightyString::HTML.strip_first_seq("APPLES n APPLES ARE Yummy!","APPLES",{"APPLES" => "COWS"}) == "COWS n APPLES ARE Yummy!"
41
+ assert MightyString::HTML.strip_first_seq("Cows Cows and more Cows!","Cows", {"Cows" => "Winner"}) == "Winner Cows and more Cows!"
42
+ assert MightyString::HTML.strip_first_seq("&nbsp; ---- &nbsp; APPLES &nbps;", "&nbsp;" ) == " ---- &nbsp; APPLES &nbps;"
43
+ assert MightyString::HTML.strip_first_seq("&trade; ---- &trade; TradeMark &trade;", "&trade;" ) == "(TM) ---- &trade; TradeMark &trade;"
44
+ end
45
+
46
+ def test_strip_html
47
+ assert MightyString::HTML.strip_html("<html>") == ""
48
+ assert MightyString::HTML.strip_html("<table><tr><td>Piped sides.</td></tr></table>") == " | Piped sides. | "
49
+ assert MightyString::HTML.strip_html("Hello<br>World!") == "Hello\nWorld!"
50
+ assert MightyString::HTML.strip_html("<p>&quot;Quoted&quot; Copyright &copy; TradeMark &trade;</p>") == "'Quoted' Copyright (c) TradeMark (TM)"
51
+ end
52
+ end
53
+
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mightystring
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
5
- prerelease:
4
+ version: 0.1.5.b
6
5
  platform: ruby
7
6
  authors:
8
7
  - Daniel P. Clark / 6ftDan(TM)
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2014-04-23 00:00:00.000000000 Z
11
+ date: 2014-09-15 00:00:00.000000000 Z
13
12
  dependencies: []
14
13
  description: Array functionality in Strings as well as Matching, Indexing, Substitution,
15
14
  Deletion, and more.
@@ -19,43 +18,55 @@ executables:
19
18
  extensions: []
20
19
  extra_rdoc_files: []
21
20
  files:
22
- - lib/mightystring/string_stripbyac.rb
23
- - lib/mightystring/string_matchpci.rb
21
+ - LICENSE
22
+ - README.md
23
+ - bin/ms-striphtml
24
+ - lib/mightystring.rb
25
+ - lib/mightystring/string_at.rb
24
26
  - lib/mightystring/string_del.rb
27
+ - lib/mightystring/string_each.rb
28
+ - lib/mightystring/string_fetch.rb
29
+ - lib/mightystring/string_find.rb
30
+ - lib/mightystring/string_first.rb
25
31
  - lib/mightystring/string_index_all.rb
26
- - lib/mightystring/version.rb
32
+ - lib/mightystring/string_join.rb
33
+ - lib/mightystring/string_last.rb
34
+ - lib/mightystring/string_map.rb
35
+ - lib/mightystring/string_match_pci.rb
36
+ - lib/mightystring/string_method_missing.rb
37
+ - lib/mightystring/string_pop.rb
38
+ - lib/mightystring/string_push.rb
39
+ - lib/mightystring/string_shift.rb
40
+ - lib/mightystring/string_sort.rb
41
+ - lib/mightystring/string_strip_byac.rb
42
+ - lib/mightystring/string_unshift.rb
27
43
  - lib/mightystring/strip_html.rb
28
- - lib/mightystring/string_at.rb
29
- - lib/mightystring.rb
44
+ - lib/mightystring/version.rb
30
45
  - test/test_ms.rb
31
- - README
32
- - LICENSE
33
- - bin/ms-striphtml
34
46
  homepage: http://www.github.com/danielpclark/mightystring
35
47
  licenses:
36
48
  - The MIT License (MIT)
37
- post_install_message: Enjoy MightyString! Your strings are now more powerful.\n\nPeak
38
- around inside String and MightyString.\n\nhttp://www.github.com/danielpclark/mightystring
49
+ metadata: {}
50
+ post_install_message:
39
51
  rdoc_options: []
40
52
  require_paths:
41
53
  - lib
42
54
  required_ruby_version: !ruby/object:Gem::Requirement
43
- none: false
44
55
  requirements:
45
- - - ! '>='
56
+ - - ">="
46
57
  - !ruby/object:Gem::Version
47
58
  version: '0'
48
59
  required_rubygems_version: !ruby/object:Gem::Requirement
49
- none: false
50
60
  requirements:
51
- - - ! '>='
61
+ - - ">"
52
62
  - !ruby/object:Gem::Version
53
- version: '0'
63
+ version: 1.3.1
54
64
  requirements: []
55
65
  rubyforge_project:
56
- rubygems_version: 1.8.28
66
+ rubygems_version: 2.3.0
57
67
  signing_key:
58
- specification_version: 3
59
- summary: Strings (are) Arrays & Matching, Indexing, Substitution, Deletion, and more.
68
+ specification_version: 4
69
+ summary: Strings (are) Arrays with Matching, Indexing, Substitution, Deletion, and
70
+ more.
60
71
  test_files:
61
72
  - test/test_ms.rb
@@ -1,16 +0,0 @@
1
- # Part of MightyString
2
- # by Daniel P. Clark
3
- # webmaster@6ftdan.com
4
-
5
- # Match Partial Case-Insensitive
6
- module Match_PCI
7
- module String
8
- # Match Partial Case-Insensitive: Usage: "My string has this?".matchpci('RinG') => true
9
- def match_pci(in_srch = "")
10
- if not in_srch.empty?
11
- return !!self.downcase[in_srch.downcase]
12
- end
13
- return false
14
- end
15
- end
16
- end