Class: Hylite
- Inherits:
-
Object
- Object
- Hylite
- Defined in:
- lib/hylite.rb,
lib/hylite/cli.rb,
lib/hylite/version.rb,
lib/hylite/hyliters.rb,
lib/hylite/choose_hyliter.rb
Defined Under Namespace
Modules: ChooseHyliter Classes: CLI, CodeRay, Hyliter, Pygments, Rouge
Constant Summary collapse
- VERSION =
'1.0.0'
Instance Attribute Summary collapse
-
#lang ⇒ Object
readonly
Returns the value of attribute lang.
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(to_highlight, options = {}) ⇒ Hylite
constructor
A new instance of Hylite.
Constructor Details
#initialize(to_highlight, options = {}) ⇒ Hylite
Returns a new instance of Hylite.
10 11 12 13 14 15 16 17 18 |
# File 'lib/hylite.rb', line 10 def initialize(to_highlight, ={}) self.to_highlight = to_highlight .each do |key, value| if key =~ /^l/ self.lang = value end end self.lang ||= 'ruby' end |
Instance Attribute Details
#lang ⇒ Object
Returns the value of attribute lang.
8 9 10 |
# File 'lib/hylite.rb', line 8 def lang @lang end |
Class Method Details
.call(*args) ⇒ Object
4 5 6 |
# File 'lib/hylite.rb', line 4 def self.call(*args) new(*args).call end |
Instance Method Details
#call ⇒ Object
20 21 22 23 24 |
# File 'lib/hylite.rb', line 20 def call code = to_highlight code = code.read if code.respond_to? :read hyliter(code, lang).call end |