buzzcore 0.4.2 → 0.4.3
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.
- data/VERSION +1 -1
- data/buzzcore.gemspec +2 -2
- data/lib/buzzcore/extra/html_truncate.rb +7 -0
- data/lib/buzzcore/string_utils.rb +12 -0
- metadata +2 -2
data/VERSION
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.3
|
2
2
|
|
data/buzzcore.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{buzzcore}
|
8
|
-
s.version = "0.4.
|
8
|
+
s.version = "0.4.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["buzzware"]
|
12
|
-
s.date = %q{2010-06-
|
12
|
+
s.date = %q{2010-06-30}
|
13
13
|
s.description = %q{buzzcore is the ruby core library developed and used by Buzzware Solutions.}
|
14
14
|
s.email = %q{contact@buzzware.com.au}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -7,6 +7,18 @@ module StringUtils
|
|
7
7
|
return aEllipsis ? aString[0,aLength-3]+'...' : aString[0,aLength]
|
8
8
|
end
|
9
9
|
|
10
|
+
def self.simplify_whitespace(aText)
|
11
|
+
aText.gsub(/[ \n\t\r]+/,' ').strip
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.crop_to_word_count(aText,aWordCount)
|
15
|
+
aText = simplify_whitespace(aText)
|
16
|
+
matches = aText.scan_md(/[^\w-]+/)
|
17
|
+
match = matches[aWordCount-1]
|
18
|
+
result = (match ? match.pre_match : aText)
|
19
|
+
result
|
20
|
+
end
|
21
|
+
|
10
22
|
# aTemplate is a string containing tokens like ${SOME_TOKEN}
|
11
23
|
# aValues is a hash of token names eg. 'SOME_TOKEN' and their values to substitute
|
12
24
|
def self.render_template(aTemplate,aValues)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: buzzcore
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- buzzware
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-06-
|
12
|
+
date: 2010-06-30 00:00:00 +08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|