Class: Germinate::TextHunk

Inherits:
Hunk
  • Object
show all
Defined in:
lib/germinate/hunk.rb

Overview

Represents a hunk of article text

Constant Summary

Constants included from SharedStyleAttributes

SharedStyleAttributes::TEXT_TRANSFORMS

Instance Method Summary collapse

Methods inherited from Hunk

#[], #index_matching, #inspect, #resolve_insertions, #slice, #strip, #to_s, #whole_file?

Methods included from SharedStyleAttributes

#copy_attributes!, #copy_shared_style_attributes_from, #disable_all_transforms!, #shared_style_attributes

Constructor Details

#initialize(contents = [], template = {}) ⇒ TextHunk

Returns a new instance of TextHunk.



128
129
130
131
132
133
134
135
136
# File 'lib/germinate/hunk.rb', line 128

def initialize(contents = [], template = {})
  self.join_lines        = true
  self.strip_blanks      = true
  self.rstrip_lines      = true
  self.uncomment         = true
  self.expand_insertions = true
  self.flatten_nested    = true
  super
end

Instance Method Details

#format_with(formatter) ⇒ Object



138
139
140
141
142
# File 'lib/germinate/hunk.rb', line 138

def format_with(formatter)
  super(formatter) do |formatter|
    formatter.format_text!(self, comment_prefix)
  end
end