jackb 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +0 -1
- data/Rakefile +0 -1
- data/VERSION +1 -1
- data/jackb.gemspec +4 -4
- data/lib/jack.rb +1 -1
- data/lib/jack/string.rb +40 -0
- data/spec/lib/string_spec.rb +21 -0
- metadata +6 -20
data/Gemfile
CHANGED
data/Rakefile
CHANGED
@@ -32,7 +32,6 @@ begin
|
|
32
32
|
gemspec.add_dependency('rdiscount', '>= 1.6.3.2')
|
33
33
|
gemspec.add_dependency('open4', '>= 1.0.1')
|
34
34
|
gemspec.add_dependency('albino', '>= 1.0')
|
35
|
-
gemspec.add_dependency('activesupport', '>= 3.0.0.beta4')
|
36
35
|
end
|
37
36
|
rescue LoadError
|
38
37
|
puts "Jeweler not available. Install it with: gem install jeweler"
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.3
|
data/jackb.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{jackb}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Damien MATHIEU"]
|
@@ -26,10 +26,12 @@ Gem::Specification.new do |s|
|
|
26
26
|
"lib/jack/highlight.rb",
|
27
27
|
"lib/jack/html.rb",
|
28
28
|
"lib/jack/markdown.rb",
|
29
|
+
"lib/jack/string.rb",
|
29
30
|
"spec/lib/highlight_spec.rb",
|
30
31
|
"spec/lib/html_spec.rb",
|
31
32
|
"spec/lib/jack_spec.rb",
|
32
33
|
"spec/lib/markdown_spec.rb",
|
34
|
+
"spec/lib/string_spec.rb",
|
33
35
|
"spec/spec_helper.rb"
|
34
36
|
]
|
35
37
|
s.homepage = %q{http://github.com/dmathieu/jack}
|
@@ -41,6 +43,7 @@ Gem::Specification.new do |s|
|
|
41
43
|
"spec/lib/markdown_spec.rb",
|
42
44
|
"spec/lib/html_spec.rb",
|
43
45
|
"spec/lib/highlight_spec.rb",
|
46
|
+
"spec/lib/string_spec.rb",
|
44
47
|
"spec/lib/jack_spec.rb",
|
45
48
|
"spec/spec_helper.rb"
|
46
49
|
]
|
@@ -53,18 +56,15 @@ Gem::Specification.new do |s|
|
|
53
56
|
s.add_runtime_dependency(%q<rdiscount>, [">= 1.6.3.2"])
|
54
57
|
s.add_runtime_dependency(%q<open4>, [">= 1.0.1"])
|
55
58
|
s.add_runtime_dependency(%q<albino>, [">= 1.0"])
|
56
|
-
s.add_runtime_dependency(%q<activesupport>, [">= 3.0.0.beta4"])
|
57
59
|
else
|
58
60
|
s.add_dependency(%q<rdiscount>, [">= 1.6.3.2"])
|
59
61
|
s.add_dependency(%q<open4>, [">= 1.0.1"])
|
60
62
|
s.add_dependency(%q<albino>, [">= 1.0"])
|
61
|
-
s.add_dependency(%q<activesupport>, [">= 3.0.0.beta4"])
|
62
63
|
end
|
63
64
|
else
|
64
65
|
s.add_dependency(%q<rdiscount>, [">= 1.6.3.2"])
|
65
66
|
s.add_dependency(%q<open4>, [">= 1.0.1"])
|
66
67
|
s.add_dependency(%q<albino>, [">= 1.0"])
|
67
|
-
s.add_dependency(%q<activesupport>, [">= 3.0.0.beta4"])
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
data/lib/jack.rb
CHANGED
data/lib/jack/string.rb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
module Jack
|
2
|
+
module String
|
3
|
+
def self.included(klass)
|
4
|
+
klass.class_eval do
|
5
|
+
def camelize
|
6
|
+
self.split(/[^a-z0-9]/i).map{|w| w.capitalize}.join
|
7
|
+
end
|
8
|
+
|
9
|
+
|
10
|
+
# Ruby 1.9 introduces an inherit argument for Module#const_get and
|
11
|
+
# #const_defined? and changes their default behavior.
|
12
|
+
# Taken from rails' inflectors. http://github.com/rails/rails/blob/master/activesupport/lib/active_support/inflector/methods.rb
|
13
|
+
if Module.method(:const_get).arity == 1
|
14
|
+
def constantize
|
15
|
+
names = self.split('::')
|
16
|
+
names.shift if names.empty? || names.first.empty?
|
17
|
+
|
18
|
+
constant = Object
|
19
|
+
names.each do |name|
|
20
|
+
constant = constant.const_defined?(name) ? constant.const_get(name) : constant.const_missing(name)
|
21
|
+
end
|
22
|
+
constant
|
23
|
+
end
|
24
|
+
else
|
25
|
+
def constantize
|
26
|
+
names = self.split('::')
|
27
|
+
names.shift if names.empty? || names.first.empty?
|
28
|
+
|
29
|
+
constant = Object
|
30
|
+
names.each do |name|
|
31
|
+
constant = constant.const_defined?(name, false) ? constant.const_get(name) : constant.const_missing(name)
|
32
|
+
end
|
33
|
+
constant
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
String.send(:include, Jack::String)
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe String do
|
4
|
+
|
5
|
+
it 'should include the camelize method' do
|
6
|
+
"string".respond_to?(:camelize).should eql(true)
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'should include the constantize method' do
|
10
|
+
"string".respond_to?(:constantize).should eql(true)
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'should camelize the string' do
|
14
|
+
"html".camelize.should eql('Html')
|
15
|
+
"ht_ml".camelize.should eql('HtMl')
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'should constantize a string' do
|
19
|
+
"String".constantize.new.should be_kind_of String
|
20
|
+
end
|
21
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jackb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 3
|
10
|
+
version: 0.0.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Damien MATHIEU
|
@@ -66,23 +66,6 @@ dependencies:
|
|
66
66
|
name: albino
|
67
67
|
requirement: *id003
|
68
68
|
type: :runtime
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
prerelease: false
|
71
|
-
version_requirements: &id004 !ruby/object:Gem::Requirement
|
72
|
-
none: false
|
73
|
-
requirements:
|
74
|
-
- - ">="
|
75
|
-
- !ruby/object:Gem::Version
|
76
|
-
hash: -1848230024
|
77
|
-
segments:
|
78
|
-
- 3
|
79
|
-
- 0
|
80
|
-
- 0
|
81
|
-
- beta4
|
82
|
-
version: 3.0.0.beta4
|
83
|
-
name: activesupport
|
84
|
-
requirement: *id004
|
85
|
-
type: :runtime
|
86
69
|
description: Takes some content and parses it depending of the format your specify (HTML or Markdown)
|
87
70
|
email: 42@dmathieu.com
|
88
71
|
executables: []
|
@@ -102,10 +85,12 @@ files:
|
|
102
85
|
- lib/jack/highlight.rb
|
103
86
|
- lib/jack/html.rb
|
104
87
|
- lib/jack/markdown.rb
|
88
|
+
- lib/jack/string.rb
|
105
89
|
- spec/lib/highlight_spec.rb
|
106
90
|
- spec/lib/html_spec.rb
|
107
91
|
- spec/lib/jack_spec.rb
|
108
92
|
- spec/lib/markdown_spec.rb
|
93
|
+
- spec/lib/string_spec.rb
|
109
94
|
- spec/spec_helper.rb
|
110
95
|
has_rdoc: true
|
111
96
|
homepage: http://github.com/dmathieu/jack
|
@@ -145,5 +130,6 @@ test_files:
|
|
145
130
|
- spec/lib/markdown_spec.rb
|
146
131
|
- spec/lib/html_spec.rb
|
147
132
|
- spec/lib/highlight_spec.rb
|
133
|
+
- spec/lib/string_spec.rb
|
148
134
|
- spec/lib/jack_spec.rb
|
149
135
|
- spec/spec_helper.rb
|