class Rembrandt::Formatters::FormattedCode

Attributes

code[R]
language[R]

Public Class Methods

new(input_code, input_language) click to toggle source
# File lib/rembrandt/formatters/formatted_code.rb, line 6
def initialize(input_code, input_language)
  @code = extract_code_from_html(input_code)
  @language = input_language
end

Public Instance Methods

extract_code_from_html(input) click to toggle source
# File lib/rembrandt/formatters/formatted_code.rb, line 15
def extract_code_from_html(input)
  matches = input.match(/<pre>(.+)<\/pre>/m)
  matches[1] if matches
end
line_count() click to toggle source
# File lib/rembrandt/formatters/formatted_code.rb, line 11
def line_count
  code.lines.count
end