Class: Fold::AbstractFold
- Inherits:
-
OpenStruct
- Object
- OpenStruct
- Fold::AbstractFold
- Defined in:
- lib/fold/abstract_fold.rb
Constant Summary collapse
- Regex =
//
Instance Method Summary collapse
-
#initialize(source = {}) ⇒ AbstractFold
constructor
A new instance of AbstractFold.
- #render ⇒ Object
- #render_children ⇒ Object
Constructor Details
#initialize(source = {}) ⇒ AbstractFold
Returns a new instance of AbstractFold.
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/fold/abstract_fold.rb', line 6 def initialize source={} attrs= { :text => '', :children => [], :tabs => -1 }.merge(source) attrs[:text].gsub! self.class::Regex, '' if self.class.clear_match super attrs end |
Instance Method Details
#render ⇒ Object
18 19 20 |
# File 'lib/fold/abstract_fold.rb', line 18 def render text end |
#render_children ⇒ Object
22 23 24 |
# File 'lib/fold/abstract_fold.rb', line 22 def render_children children.map{|child| child.render} end |