Method: ITerm2::Protocol::ImageSequence#to_h

Defined in:
lib/iterm2/protocol/image_sequence.rb

#to_h(output = nil) ⇒ Hash

Return the arguments to this escape sequence.

Parameters:

  • output (nil, Symbol) (defaults to: nil)

    The output format to return the Hash for.

    Set to ‘:terminal` to format for an escape sequence.

Returns:

  • (Hash)


76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/iterm2/protocol/image_sequence.rb', line 76

def to_h(output=nil)
  result = {
    width: @width,
    height: @height
  }

  if output == :terminal
    result[:preserveAspectRatio] = @preserve_aspect_ratio ? 1 : 0
  else
    result[:preserve_aspect_ratio] = @preserve_aspect_ratio
  end

  super(output).merge(result)
end