Method: Mist::Post#load_code_examples_from_gist
- Defined in:
- app/models/mist/post.rb
#load_code_examples_from_gist ⇒ Object
201 202 203 204 205 206 207 208 209 210 211 212 213 |
# File 'app/models/mist/post.rb', line 201 def load_code_examples_from_gist if gist && gist.persisted? self.content = self.content.dup.tap do |result| code_examples.reverse.each do |example| if gist.files[example.filename] lines = gist.files[example.filename][:content].split("\n") lines.unshift " file: #{example.filename}" result[example.offset] = lines.join("\n ") + "\n" end end end end end |