class Infoboxer::Tree::Image
Represents image (or other media file).
See [Wikipedia Tutorial](en.wikipedia.org/wiki/Wikipedia:Extended_image_syntax) for explanation of attributes.
Attributes
caption[R]
Image
caption. Can have (sometimes many) other nodes inside.
@return [Nodes]
Public Class Methods
new(path, caption: nil, **params)
click to toggle source
Calls superclass method
# File lib/infoboxer/tree/image.rb, line 10 def initialize(path, caption: nil, **params) @caption = caption super(path: path, **params) end
Public Instance Methods
border?()
click to toggle source
# File lib/infoboxer/tree/image.rb, line 31 def border? !params[:border].to_s.empty? end
height()
click to toggle source
# File lib/infoboxer/tree/image.rb, line 39 def height params[:height].to_i end
to_tree(level = 0)
click to toggle source
Calls superclass method
# File lib/infoboxer/tree/image.rb, line 43 def to_tree(level = 0) super(level) + if caption && !caption.empty? indent(level + 1) + "caption:\n" + caption.children.map { |c| c.to_tree(level + 2) }.join else '' end end
width()
click to toggle source
# File lib/infoboxer/tree/image.rb, line 35 def width params[:width].to_i end
Private Instance Methods
_eq(other)
click to toggle source
# File lib/infoboxer/tree/image.rb, line 55 def _eq(other) path == other.path end