texttube 6.0.0 → 6.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d2fd3b516b75ad314db454507278459173618f6e
4
- data.tar.gz: 33b727194070771ecb3e32517204f376c1ec468c
3
+ metadata.gz: 610f0fe430a90ce6e8de9b697d41e81029cdd82c
4
+ data.tar.gz: a334d2477567f2be643d05076866fb4fd6f41e1e
5
5
  SHA512:
6
- metadata.gz: 114c1141b316a4e5ad05f92487ceb4a014fb542794fe150d348c1bb9527e9c90e11f86db33bc44889495a34396999be68999c99ea116675c310bd1ed89224384
7
- data.tar.gz: 6216d74f04173b226bcebaa5de1ba673e09d52822ffba0e4c09f2ece08c2c1c40365191f5837fc08369bab7a754b1004b14255b8785a39fbba1e841184a49067
6
+ metadata.gz: eb605ac48e32f2cb5066fddeaab12be996435e5517d205f774f4957e7530b2fd174ec0e7b64e092907f69e2418470762de03a63f0a059ff3b8cd2cbf8009ab1a
7
+ data.tar.gz: c9df73120109399f0efd543c46f5c521c76f05a42bb6fde52b75e91321012d2c6cf75c8369dc2ff455abc5066b4a3e332d43fb0045e15292520f532fd805072c
data/.gitignore CHANGED
@@ -19,6 +19,7 @@ rdoc
19
19
  Gemfile.lock
20
20
  bin/
21
21
  vendor/
22
+ vendor.noindex/
22
23
  coverage/
23
24
  docs/
24
25
  .yardoc/
data/CHANGES.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # CH CH CH CHANGES! #
2
2
 
3
+
4
+ ## Friday the 12th of June 2015, v6.1.0 ##
5
+
6
+ * Got rid of some ext methods that weren't needed or used.
7
+ * Updated the docs for Github with the syntax highlighting hints.
8
+
9
+ ----
10
+
11
+
3
12
  ## Friday the 17th of October 2014, v6.0.0 ##
4
13
 
5
14
  * Moved extra filters into TextTubeBaby to make the library lighter and easier to install.
data/README.md CHANGED
@@ -26,79 +26,90 @@ You want to filter/transform a string. You also want to run several filters acro
26
26
 
27
27
  In practice this means:
28
28
 
29
+ ```ruby
30
+ require 'texttube/filterable'
29
31
 
30
- require 'texttube/filterable'
31
-
32
- module AFilter
33
- extend TextTube::Filterable
34
-
35
- filter_with :double do |text|
36
- text * 2
37
- end
38
-
39
- filter_with :triple do |text|
40
- text * 3
41
- end
42
- end
43
-
44
- module BFil
45
- extend TextTube::Filterable
46
-
47
- filter_with :spacial do |current,options|
48
- current.split(//).join " "
49
- end
50
- end
32
+ module AFilter
33
+ extend TextTube::Filterable
34
+
35
+ filter_with :double do |text|
36
+ text * 2
37
+ end
38
+
39
+ filter_with :triple do |text|
40
+ text * 3
41
+ end
42
+ end
51
43
 
52
- require 'texttube/base'
44
+ module BFil
45
+ extend TextTube::Filterable
53
46
 
54
- class NeuS < TextTube::Base
55
- register BFil
56
- register AFilter
57
- register do # on the fly
58
- filter_with :dashes do |text|
59
- "---#{text}---"
60
- end
61
- end
47
+ filter_with :spacial do |current,options|
48
+ current.split(//).join " "
49
+ end
50
+ end
51
+
52
+ require 'texttube/base'
53
+
54
+ class NeuS < TextTube::Base
55
+ register BFil
56
+ register AFilter
57
+ register do # on the fly
58
+ filter_with :dashes do |text|
59
+ "---#{text}---"
62
60
  end
61
+ end
62
+ end
63
+ ```
63
64
 
64
65
  Now there is a class `NeuS` which will run filters `:spacial`, `:double`, `:triple`, and `:dashes` in that order, on a given string. For example:
65
66
 
66
- n = NeuS.new "abc"
67
+ ```ruby
68
+ n = NeuS.new "abc"
69
+ ```
67
70
 
68
71
  Running all of the filters:
69
72
 
70
- n.filter
71
- # => "---a b ca b ca b ca b ca b ca b c---"
73
+ ```ruby
74
+ n.filter
75
+ # => "---a b ca b ca b ca b ca b ca b c---"
76
+ ```
72
77
 
73
78
  Or just some of the filters:
74
79
 
75
- n.filter :spacial
76
- # => "a b c"
77
- n.filter :spacial, :dashes
78
- # => "---a b c---"
80
+ ```
81
+ n.filter :spacial
82
+ # => "a b c"
83
+ n.filter :spacial, :dashes
84
+ # => "---a b c---"
85
+ ```
79
86
 
80
87
  Run them more than once:
81
-
82
- n.filter :double, :triple, :double
83
- # => "abcabcabcabcabcabcabcabcabcabcabcabc"
88
+
89
+ ```ruby
90
+ n.filter :double, :triple, :double
91
+ # => "abcabcabcabcabcabcabcabcabcabcabcabc"
92
+ ```
84
93
 
85
94
  ### Creating a filter ###
86
95
 
87
96
  Make something _filterable_:
88
97
 
89
- require 'texttube/filterable'
90
-
91
- module AnotherFilter
92
- extend TextTube::Filterable
93
-
94
- filter_with :copyright do |text|
95
- text << " ©#{Time.now.year}. "
96
- end
97
-
98
- filter_with :number do |text,options|
99
- text * options[:times].to_i
100
- end
101
- end
98
+ ```ruby
99
+ require 'texttube/filterable'
100
+
101
+ module AnotherFilter
102
+ extend TextTube::Filterable
103
+
104
+ filter_with :copyright do |text|
105
+ text << " ©#{Time.now.year}. "
106
+ end
107
+
108
+ filter_with :number do |text,options|
109
+ text * options[:times].to_i
110
+ end
111
+ end
112
+ ```
102
113
 
103
114
  That's all there is to creating a filter.
104
115
 
@@ -106,34 +117,36 @@ That's all there is to creating a filter.
106
117
 
107
118
  The class picks which filters to use, and can add filters on the fly, by using `register`:
108
119
 
109
- require 'texttube/base'
110
-
111
- class MyString < TextTube::Base
112
- register AnotherFilter
113
- register do
114
- filter_with :my_name do |text|
115
- text.gsub "Iain Barnett", %q!<a href="iainbarnett.me.uk" title="My blog">Iain Barnett</a>!
116
- end
117
- end
120
+ ```ruby
121
+ require 'texttube/base'
122
+
123
+ class MyString < TextTube::Base
124
+ register AnotherFilter
125
+ register do
126
+ filter_with :my_name do |text|
127
+ text.gsub "Iain Barnett", %q!<a href="iainbarnett.me.uk" title="My blog">Iain Barnett</a>!
118
128
  end
119
-
120
- s = MyString.new "Let me introduce Iain Barnett. He writes Ruby code."
121
- # => "Let me introduce Iain Barnett. He writes Ruby code."
129
+ end
130
+ end
131
+
132
+ s = MyString.new "Let me introduce Iain Barnett. He writes Ruby code."
133
+ # => "Let me introduce Iain Barnett. He writes Ruby code."
122
134
 
123
- MyString.options.merge! :number => {times: 2}
124
- # => {:number=>{:times=>2}}
135
+ MyString.options.merge! :number => {times: 2}
136
+ # => {:number=>{:times=>2}}
125
137
 
126
- s.filter
127
- # => "Let me introduce <a href="iainbarnett.me.uk" title="My blog">Iain Barnett</a>. He writes Ruby code. ©2013. Let me introduce <a href="iainbarnett.me.uk" title="My blog">Iain Barnett</a>. He writes Ruby code. ©2013. "
138
+ s.filter
139
+ # => "Let me introduce <a href="iainbarnett.me.uk" title="My blog">Iain Barnett</a>. He writes Ruby code. ©2013. Let me introduce <a href="iainbarnett.me.uk" title="My blog">Iain Barnett</a>. He writes Ruby code. ©2013. "
140
+ ```
128
141
 
129
142
  ### Ready made filters ###
130
143
 
131
- They used to come with this library, but sometimes they caused problems with installation (things like Nokogiri can be painful to install at times) so I spun them off into their own library - TextTubeBaby!
144
+ They used to come with this library, but sometimes they caused problems with installation (things like Nokogiri can be painful to install at times) so I spun them off into their own library - [TextTubeBaby](https://github.com/yb66/TextTubeBaby)!
132
145
 
133
146
 
134
147
  ### Contributors ###
135
148
 
136
- Many thanks to Eleni Karinou and [Annette Smith](https://twitter.com/moosecatear) for brainsplatting a new name for the library, and after many unusable and clearly disturbing suggestions, to Annette for the final name (and its spin off, TextTubeBaby).
149
+ Many thanks to Eleni Karinou and [Annette Smith](https://twitter.com/moosecatear) for brainsplatting a new name for the library, and after many unusable and clearly disturbing suggestions, to Annette for the final name (and its spin off, [TextTubeBaby](https://github.com/yb66/TextTubeBaby)).
137
150
 
138
151
 
139
152
  ### Licence ###
@@ -2,5 +2,5 @@
2
2
 
3
3
  module TextTube
4
4
  # This library's version.
5
- VERSION = "6.0.0"
5
+ VERSION = "6.1.0"
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: texttube
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.0
4
+ version: 6.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Iain Barnett
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-17 00:00:00.000000000 Z
11
+ date: 2015-06-12 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Create chainable filters with ease.
14
14
  email: iainspeed @nospam@ gmail.com
@@ -22,9 +22,6 @@ files:
22
22
  - Gemfile
23
23
  - README.md
24
24
  - Rakefile
25
- - lib/ext/blank.rb
26
- - lib/ext/to_constant.rb
27
- - lib/texttube.rb
28
25
  - lib/texttube/base.rb
29
26
  - lib/texttube/filterable.rb
30
27
  - lib/texttube/version.rb
@@ -51,7 +48,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
51
48
  version: '0'
52
49
  requirements: []
53
50
  rubyforge_project:
54
- rubygems_version: 2.2.2
51
+ rubygems_version: 2.4.5
55
52
  signing_key:
56
53
  specification_version: 4
57
54
  summary: Create chainable filters with ease.
data/lib/ext/blank.rb DELETED
@@ -1,17 +0,0 @@
1
- # encoding: UTF-8
2
-
3
- module TextTube
4
- module CoreExtensions
5
-
6
- def blank?
7
- respond_to?(:empty?) ?
8
- empty? :
9
- !self
10
- end
11
- end
12
- end
13
-
14
- # Standard lib class.
15
- class Hash
16
- include TextTube::CoreExtensions
17
- end
@@ -1,26 +0,0 @@
1
- module TextTube
2
-
3
- # Core lib extensions reside here.
4
- module CoreExtensions
5
- # to_constant tries to find a declared constant with the name specified
6
- # in the string. It raises a NameError when the name is not in CamelCase
7
- # or is not initialized.
8
- #
9
- # Examples
10
- # "Module".to_constant #=> Module
11
- # "Class".to_constant #=> Class
12
- def to_constant
13
- unless /\A(?:::)?([A-Z]\w*(?:::[A-Z]\w*)*)\z/ =~ self
14
- fail NameError, "#{self.inspect} is not a valid constant name!"
15
- end
16
-
17
- Object.module_eval("::#{$1}", __FILE__, __LINE__)
18
- end
19
- end
20
- end
21
-
22
-
23
- # Standard lib String class gets some extras.
24
- class String
25
- include TextTube::CoreExtensions
26
- end
data/lib/texttube.rb DELETED
@@ -1,4 +0,0 @@
1
- # encoding: UTF-8
2
-
3
- require_relative "./ext/blank.rb"
4
- require_relative "./ext/to_constant.rb"