Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Move class BlockComponent into component.rb

With a BlockComponent you can quickly define a
"component" using a code block instead of declaring
a new class.
  • Loading branch information...
commit 28820dc8ecf7d987c9fc54ed824171a76a793bef 1 parent b53db7b
@mneumann authored
Showing with 10 additions and 0 deletions.
  1. +10 −0 lib/wee/component.rb
View
10 lib/wee/component.rb
@@ -132,4 +132,14 @@ def state_decoration(s)
end # class Component
+ class BlockComponent < Component
+ def initialize(&block)
+ @block = block
+ end
+
+ def render(r)
+ instance_exec(r, &@block)
+ end
+ end # class BlockComponent
+
end # module Wee
Please sign in to comment.
Something went wrong with that request. Please try again.