Class: Germinate::CodeHunk

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

Overview

Represents a hunk of source code

Direct Known Subclasses

FileHunk

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 = {}) ⇒ CodeHunk

Returns a new instance of CodeHunk.



147
148
149
150
151
# File 'lib/germinate/hunk.rb', line 147

def initialize(contents = [], template = {})
  self.strip_blanks = true
  self.bracket      = true
  super
end

Instance Method Details

#code_close_bracket=(new_value) ⇒ Object



157
158
159
# File 'lib/germinate/hunk.rb', line 157

def code_close_bracket=(new_value)
  super
end

#code_open_bracket=(new_value) ⇒ Object



153
154
155
# File 'lib/germinate/hunk.rb', line 153

def code_open_bracket=(new_value)
  super
end

#format_with(formatter) ⇒ Object



162
163
164
165
166
# File 'lib/germinate/hunk.rb', line 162

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