end_view 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +31 -23
  3. data/lib/end_view.rb +2 -2
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 63aa81146014a478d440cd1bd4c399086b8a0fc9
4
- data.tar.gz: 523d609c402388617d2443f5f7497322af28335b
3
+ metadata.gz: 3ca9c4f5f9b15471377b2a14e38769126f23a3b0
4
+ data.tar.gz: 7a0b708d6d24fbc83254e43e1d720ad90bab9341
5
5
  SHA512:
6
- metadata.gz: e90add1ccf0ebd01957297a0bf5685aa6db73043cc77ea6476de2d325d7bb8f9d6c6f1bf419508bad6024527f063929fb962fcb4d45909278b2a0dc634edb7ce
7
- data.tar.gz: cb9cafe54a4ae5fb8ceffd927137b31d592b312d7fc7a98e1788c2a1033f34ca29dcdfff6436bf9a8fa8424eefd00a507f7b022a222952e9375fb7b649d52d19
6
+ metadata.gz: 74c7f9dc759075b7c66fcb3b955eac6548d4127763a5fb26984fc2d14951d7bcf3ed917a33b99b514dc4067763f8ea75d0483468365a20e45b81dba3f7ac7917
7
+ data.tar.gz: 5ecc6e8025ed52148f30a14a4f3bea3475ca36085693f6f798f81b888b928d0f1c34c48d2290427bb6226d9152737ebd99c219c34ae9f6bb7a3924983dbb1e75
data/README.md CHANGED
@@ -45,6 +45,34 @@ __END__
45
45
  Howdy <%= my_method %>
46
46
  ```
47
47
 
48
+ ### Template Engine
49
+
50
+ By default Tilt's ERB template engine is used, but alternative engines can be passed in:
51
+
52
+ ``` ruby
53
+ require 'tilt/haml'
54
+
55
+ class Ham
56
+ include EndView.new(__FILE__, Tilt::HamlTemplate)
57
+
58
+ def my_method
59
+ 'Heya'
60
+ end
61
+ end
62
+
63
+ Ham.new.render # <h1>Heya</h1>
64
+
65
+ __END__
66
+
67
+ %h1= my_method
68
+ ```
69
+
70
+ To change the default engine:
71
+
72
+ ``` ruby
73
+ EndView.default_engine = Tilt::LiquidTemplate
74
+ ```
75
+
48
76
  ### Layouts
49
77
 
50
78
  For template engines that support it, view models can passed blocks:
@@ -108,32 +136,12 @@ __END__
108
136
  The <%= my_method %> is too big!
109
137
  ```
110
138
 
111
- ### Template Engine
139
+ ### locals
112
140
 
113
- By default Tilt's ERB template engine is used, but alternative engines can be passed in:
141
+ Locals can be passed into the render method that override the view models:
114
142
 
115
143
  ``` ruby
116
- require 'tilt/haml'
117
-
118
- class Ham
119
- include EndView.new(__FILE__, Tilt::HamlTemplate)
120
-
121
- def my_method
122
- 'Heya'
123
- end
124
- end
125
-
126
- Ham.new.render # <h1>Heya</h1>
127
-
128
- __END__
129
-
130
- %h1= my_method
131
- ```
132
-
133
- To change the default engine:
134
-
135
- ``` ruby
136
- EndView.default_engine = Tilt::LiquidTemplate
144
+ Foo.new.render(my_method: 'Stranger') # Hello Stranger
137
145
  ```
138
146
 
139
147
  ## Installation
data/lib/end_view.rb CHANGED
@@ -44,8 +44,8 @@ class EndView < Module
44
44
  end
45
45
 
46
46
  module Methods
47
- def render(&b)
48
- rendered_template = template.render(self, &b)
47
+ def render(*args, &b)
48
+ rendered_template = template.render(self, *args, &b)
49
49
  layout ? layout.render { rendered_template } : rendered_template
50
50
  end
51
51
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: end_view
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Max White