class Grandfather::CodeBlock

Attributes

code[R]
id[R]
language[R]

Public Class Methods

new(id, language, code) click to toggle source
# File lib/grandfather/codeblock.rb, line 10
def initialize(id, language, code)
  @id, @language, @code = id, language, code
end

Public Instance Methods

highlighted() click to toggle source
# File lib/grandfather/codeblock.rb, line 14
def highlighted
  if @language
    CodeRay.scan(@code, @language).html(:line_numbers => :table)
  else
    CodeRay.scan(@code, :text).div
  end
end