Class: Container

Inherits:
Object
  • Object
show all
Defined in:
lib/yesroff/text.rb

Direct Known Subclasses

Paragraph, Span

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(style, parent = nil, contents = []) ⇒ Container

Returns a new instance of Container.



60
61
62
63
# File 'lib/yesroff/text.rb', line 60

def initialize(style, parent=nil, contents=[])
  @style = style
  @contents = contents
end

Instance Attribute Details

#contentsObject

Returns the value of attribute contents.



58
59
60
# File 'lib/yesroff/text.rb', line 58

def contents
  @contents
end

#parentObject

Returns the value of attribute parent.



58
59
60
# File 'lib/yesroff/text.rb', line 58

def parent
  @parent
end

#styleObject

Returns the value of attribute style.



58
59
60
# File 'lib/yesroff/text.rb', line 58

def style
  @style
end

Instance Method Details

#<<(content) ⇒ Object



65
66
67
# File 'lib/yesroff/text.rb', line 65

def <<(content)
  @contents << content
end

#render(w) ⇒ Object



69
70
71
72
73
74
# File 'lib/yesroff/text.rb', line 69

def render(w)
  #puts "========= rendering #{self.class} size: #{contents.size}"
  #pp contents
  #puts "Rendering:"
  contents.each {|c|  c.render(w)}
end