Class: IRuby::Display::Renderer
- Inherits:
-
Object
- Object
- IRuby::Display::Renderer
- Defined in:
- lib/iruby/display.rb
Instance Attribute Summary collapse
-
#match ⇒ Object
readonly
Returns the value of attribute match.
-
#mime ⇒ Object
readonly
Returns the value of attribute mime.
-
#priority ⇒ Object
readonly
Returns the value of attribute priority.
Instance Method Summary collapse
-
#initialize(match, mime, render, priority) ⇒ Renderer
constructor
A new instance of Renderer.
- #match?(obj) ⇒ Boolean
- #render(obj) ⇒ Object
Constructor Details
#initialize(match, mime, render, priority) ⇒ Renderer
Returns a new instance of Renderer.
257 258 259 260 261 262 |
# File 'lib/iruby/display.rb', line 257 def initialize(match, mime, render, priority) @match = match @mime = mime @render = render @priority = priority end |
Instance Attribute Details
#match ⇒ Object (readonly)
Returns the value of attribute match.
255 256 257 |
# File 'lib/iruby/display.rb', line 255 def match @match end |
#mime ⇒ Object (readonly)
Returns the value of attribute mime.
255 256 257 |
# File 'lib/iruby/display.rb', line 255 def mime @mime end |
#priority ⇒ Object (readonly)
Returns the value of attribute priority.
255 256 257 |
# File 'lib/iruby/display.rb', line 255 def priority @priority end |
Instance Method Details
#match?(obj) ⇒ Boolean
264 265 266 |
# File 'lib/iruby/display.rb', line 264 def match?(obj) @match.call(obj) end |
#render(obj) ⇒ Object
268 269 270 271 |
# File 'lib/iruby/display.rb', line 268 def render(obj) result = @render.call(obj) Array === result ? result : [@mime, result] end |