hamlit 1.1.1 → 1.2.0
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/hamlit/helpers.rb +14 -0
- data/lib/hamlit/version.rb +1 -1
- data/spec/rails/app/views/users/helpers.html.haml +9 -0
- data/spec/rails/spec/hamlit_spec.rb +15 -0
- 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: cdb6bb5d76732c00209e63f4e24e651ce7f3d615
|
4
|
+
data.tar.gz: c4e4eacaa487b2629a80416f9b79d213309a3ec7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3b93143bdc0a7eda79e9f1d3ae2d86406b410c813e4c42e841b116a2d9e785492592726e375dd01a0afb8ac7481bbdf13c8c6bf0d8871ad34a93b38112bab861
|
7
|
+
data.tar.gz: 56ac9ee8f5822e8976f5f163f2467a929fd54ca0788a39193b7ede3fc44ceb527e07a7cf0396fcc74d345eb8d2319c11fb637eeb2e28c7a5fa1128faf995bd5a
|
data/CHANGELOG.md
CHANGED
data/lib/hamlit/helpers.rb
CHANGED
@@ -29,6 +29,20 @@ module Hamlit
|
|
29
29
|
s
|
30
30
|
end
|
31
31
|
|
32
|
+
def surround(front, back = front, &block)
|
33
|
+
output = capture_haml(&block)
|
34
|
+
|
35
|
+
"#{front}#{output.chomp}#{back}\n"
|
36
|
+
end
|
37
|
+
|
38
|
+
def precede(str, &block)
|
39
|
+
"#{str}#{capture_haml(&block).chomp}\n"
|
40
|
+
end
|
41
|
+
|
42
|
+
def succeed(str, &block)
|
43
|
+
"#{capture_haml(&block).chomp}#{str}\n"
|
44
|
+
end
|
45
|
+
|
32
46
|
# NOTE: currently Hamlit::Helpers is enabled by default on only
|
33
47
|
# Rails environment. Thus you can use capture.
|
34
48
|
def capture_haml(*args, &block)
|
data/lib/hamlit/version.rb
CHANGED
@@ -92,5 +92,20 @@ describe 'Hamlit rails integration', type: :request do
|
|
92
92
|
</div>
|
93
93
|
HTML
|
94
94
|
end
|
95
|
+
|
96
|
+
it 'renders succeed' do
|
97
|
+
get helpers_users_path
|
98
|
+
expect(response.body).to include('succeed.')
|
99
|
+
end
|
100
|
+
|
101
|
+
it 'renders precede' do
|
102
|
+
get helpers_users_path
|
103
|
+
expect(response.body).to include(',precede')
|
104
|
+
end
|
105
|
+
|
106
|
+
it 'renders surround' do
|
107
|
+
get helpers_users_path
|
108
|
+
expect(response.body).to include('[surround]')
|
109
|
+
end
|
95
110
|
end
|
96
111
|
end
|