Class: Crafty::Builder
Overview
Builder provides a builder-like class to construct HTML output. You can use builders if you don’t want to include the helper modules in your own builder class. You can also subclass from the Builder class to easily create your own builders.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#target ⇒ Object
readonly
Returns the value of attribute target.
Class Method Summary collapse
Instance Method Summary collapse
- #<<(output) ⇒ Object
-
#initialize(target = "") ⇒ Builder
constructor
A new instance of Builder.
- #to_s ⇒ Object
Constructor Details
#initialize(target = "") ⇒ Builder
Returns a new instance of Builder.
17 18 19 |
# File 'lib/crafty/builder.rb', line 17 def initialize(target = "") @target = target end |
Instance Attribute Details
#target ⇒ Object (readonly)
Returns the value of attribute target.
15 16 17 |
# File 'lib/crafty/builder.rb', line 15 def target @target end |
Class Method Details
.build {|builder| ... } ⇒ Object
8 9 10 11 12 |
# File 'lib/crafty/builder.rb', line 8 def build builder = new yield builder builder.to_s end |