class Hylite
Constants
- VERSION
Attributes
lang[RW]
to_highlight[RW]
Public Class Methods
call(*args)
click to toggle source
# File lib/hylite.rb, line 4 def self.call(*args) new(*args).call end
new(to_highlight, options={})
click to toggle source
# File lib/hylite.rb, line 10 def initialize(to_highlight, options={}) self.to_highlight = to_highlight options.each do |key, value| if key =~ /^l/ self.lang = value end end self.lang ||= 'ruby' end
Public Instance Methods
call()
click to toggle source
# File lib/hylite.rb, line 20 def call code = to_highlight code = code.read if code.respond_to? :read hyliter(code, lang).call end
Private Instance Methods
hyliter(code, lang)
click to toggle source
# File lib/hylite.rb, line 31 def hyliter(code, lang) ChooseHyliter.call(code, lang) end