Class: HTMLComponent::Builder
- Inherits:
-
Object
- Object
- HTMLComponent::Builder
- Defined in:
- lib/html-native/builder.rb
Instance Method Summary collapse
- #+(string) ⇒ Object
-
#initialize(strings = []) ⇒ Builder
constructor
A new instance of Builder.
- #to_s ⇒ Object (also: #to_str)
Constructor Details
#initialize(strings = []) ⇒ Builder
Returns a new instance of Builder.
4 5 6 7 8 9 10 |
# File 'lib/html-native/builder.rb', line 4 def initialize(strings = []) if strings.kind_of? String @strings = [strings] else @strings = strings.dup end end |
Instance Method Details
#+(string) ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/html-native/builder.rb', line 12 def +(string) if string.kind_of? Builder @strings << string elsif string.kind_of? HTMLComponent @strings << string.render else @strings << string.to_s end self end |
#to_s ⇒ Object Also known as: to_str
23 24 25 |
# File 'lib/html-native/builder.rb', line 23 def to_s @strings.join end |