Class: Html::Composite

Inherits:
Object show all
Defined in:
lib/html/base.rb

Overview

Class for compositing nested tags togther and using them multiple times in different contexts.

Instance Method Summary collapse

Constructor Details

#initialize(first, second) ⇒ Composite

Returns a new instance of Composite.



89
90
91
92
# File 'lib/html/base.rb', line 89

def initialize(first, second)
  @first = first
  @second = second
end

Instance Method Details

#<<(other) ⇒ Object



94
95
96
97
98
99
100
# File 'lib/html/base.rb', line 94

def << (other)
  if other.is_a?(String)
    @first << (@second << other)
  else
    Composite.new(self, other)
  end
end