Class: Black::HTMLView::Context
- Inherits:
-
Object
- Object
- Black::HTMLView::Context
- Defined in:
- lib/black/html_view.rb
Instance Method Summary collapse
- #content ⇒ Object
- #get_binding ⇒ Object
-
#highlight(line) ⇒ Object
return syntax-highlighted version of the line.
-
#initialize(data) ⇒ Context
constructor
A new instance of Context.
Constructor Details
#initialize(data) ⇒ Context
Returns a new instance of Context.
18 19 20 21 22 23 24 |
# File 'lib/black/html_view.rb', line 18 def initialize(data) data.each do |name, value| self.class.class_eval do define_method(name) { value } end end end |
Instance Method Details
#content ⇒ Object
33 34 35 |
# File 'lib/black/html_view.rb', line 33 def content @content ||= rogueify(diff.newer) end |
#get_binding ⇒ Object
38 39 40 |
# File 'lib/black/html_view.rb', line 38 def get_binding binding end |
#highlight(line) ⇒ Object
return syntax-highlighted version of the line
27 28 29 30 31 |
# File 'lib/black/html_view.rb', line 27 def highlight(line) line.deletion? ? older[line.old_line_number-1] : newer[line.new_line_number-1] end |