markevans-block_helpers 0.2.6 → 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +4 -4
- data/VERSION +1 -1
- data/block_helpers.gemspec +1 -1
- data/lib/block_helpers.rb +3 -3
- data/spec/helpers/block_helpers_spec.rb +3 -3
- metadata +1 -1
data/README.markdown
CHANGED
@@ -22,7 +22,7 @@ In the helper file:
|
|
22
22
|
|
23
23
|
module MyHelper
|
24
24
|
|
25
|
-
class MyBlockHelper <
|
25
|
+
class MyBlockHelper < BlockHelpers::Base
|
26
26
|
|
27
27
|
def hello(name)
|
28
28
|
"<p>Hi there #{name}!</p>"
|
@@ -61,7 +61,7 @@ In the helper:
|
|
61
61
|
"I'm very angry"
|
62
62
|
end
|
63
63
|
|
64
|
-
class MyBlockHelper <
|
64
|
+
class MyBlockHelper < BlockHelpers::Base
|
65
65
|
|
66
66
|
def angry
|
67
67
|
content_tag :div, helper.angry
|
@@ -89,7 +89,7 @@ In the helper:
|
|
89
89
|
|
90
90
|
module MyHelper
|
91
91
|
|
92
|
-
class MyBlockHelper <
|
92
|
+
class MyBlockHelper < BlockHelpers::Base
|
93
93
|
|
94
94
|
def initialize(tag_type)
|
95
95
|
@tag_type = tag_type
|
@@ -121,7 +121,7 @@ In the helper:
|
|
121
121
|
|
122
122
|
module MyHelper
|
123
123
|
|
124
|
-
class RoundedBox <
|
124
|
+
class RoundedBox < BlockHelpers::Base
|
125
125
|
|
126
126
|
def display(body)
|
127
127
|
%(
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.7
|
data/block_helpers.gemspec
CHANGED
data/lib/block_helpers.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
require 'activesupport'
|
2
2
|
require 'action_view'
|
3
3
|
|
4
|
-
module
|
4
|
+
module BlockHelpers
|
5
5
|
|
6
|
-
class
|
6
|
+
class Base
|
7
7
|
|
8
8
|
def self.inherited(klass)
|
9
9
|
# Define the helper method
|
10
10
|
# e.g. for a class:
|
11
|
-
# class HelloHelper <
|
11
|
+
# class HelloHelper < BlockHelpers::Base
|
12
12
|
# #.....
|
13
13
|
# end
|
14
14
|
#
|
@@ -8,7 +8,7 @@ describe TestHelperModule do
|
|
8
8
|
describe "simple block_helper" do
|
9
9
|
|
10
10
|
before(:each) do
|
11
|
-
class TestHelperModule::TestHelper <
|
11
|
+
class TestHelperModule::TestHelper < BlockHelpers::Base
|
12
12
|
def hello
|
13
13
|
'Hi there'
|
14
14
|
end
|
@@ -106,7 +106,7 @@ describe TestHelperModule do
|
|
106
106
|
describe "surrounding the block" do
|
107
107
|
|
108
108
|
before(:each) do
|
109
|
-
class TestHelperModule::TestHelperSurround <
|
109
|
+
class TestHelperModule::TestHelperSurround < BlockHelpers::Base
|
110
110
|
def display(body)
|
111
111
|
%(
|
112
112
|
<p>Before</p>
|
@@ -128,7 +128,7 @@ describe TestHelperModule do
|
|
128
128
|
|
129
129
|
describe "block helpers with arguments" do
|
130
130
|
before(:each) do
|
131
|
-
class TestHelperModule::TestHelperWithArgs <
|
131
|
+
class TestHelperModule::TestHelperWithArgs < BlockHelpers::Base
|
132
132
|
def initialize(id, klass)
|
133
133
|
@id, @klass = id, klass
|
134
134
|
end
|