Class: ITerm2::Protocol::ImageSequence
- Inherits:
-
FileSequence
- Object
- FileSequence
- ITerm2::Protocol::ImageSequence
- Defined in:
- lib/iterm2/protocol/image_sequence.rb
Overview
Escape sequence for use with inline images.
Instance Method Summary collapse
-
#height ⇒ String
Get the height.
-
#height= ⇒ String
Set the height.
-
#initialize(attributes = {}) ⇒ ImageSequence
constructor
A new instance of ImageSequence.
-
#preserve_aspect_ratio ⇒ Boolean
Get whether to preserve the aspect ratio.
-
#preserve_aspect_ratio= ⇒ Boolean
Set whether to preserve the aspect ratio.
-
#to_h(output = nil) ⇒ Hash
Return the arguments to this escape sequence.
-
#width ⇒ String
Get the width.
-
#width= ⇒ String
Set the width.
Methods inherited from FileSequence
format, #inline, #inline=, #path, #path=, #to_s
Constructor Details
#initialize(attributes = {}) ⇒ ImageSequence
9 10 11 12 13 14 15 16 17 |
# File 'lib/iterm2/protocol/image_sequence.rb', line 9 def initialize(attributes={}) @width = "auto" @height = "auto" @preserve_aspect_ratio = true super @inline = true end |
Instance Method Details
#height ⇒ String
Get the height.
|
|
# File 'lib/iterm2/protocol/image_sequence.rb', line 38
|
#height= ⇒ String
Set the height.
Given as a number followed by a unit, or the word “auto”:
N: N character cells.
Npx: N pixels.
N%: N percent of the session's width or height.
auto: The image's inherent size will be used to determine an appropriate dimension.
55 |
# File 'lib/iterm2/protocol/image_sequence.rb', line 55 attribute(:height) { |value| value.nil? ? "auto" : value.to_s } |
#preserve_aspect_ratio ⇒ Boolean
Get whether to preserve the aspect ratio.
|
|
# File 'lib/iterm2/protocol/image_sequence.rb', line 57
|
#preserve_aspect_ratio= ⇒ Boolean
Set whether to preserve the aspect ratio.
67 |
# File 'lib/iterm2/protocol/image_sequence.rb', line 67 attribute(:preserve_aspect_ratio, query: true) |
#to_h(output = nil) ⇒ Hash
Return the arguments to this escape sequence.
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 |
#width ⇒ String
Get the width.
|
|
# File 'lib/iterm2/protocol/image_sequence.rb', line 19
|
#width= ⇒ String
Set the width.
Given as a number followed by a unit, or the word “auto”:
N: N character cells.
Npx: N pixels.
N%: N percent of the session's width or height.
auto: The image's inherent size will be used to determine an appropriate dimension.
36 |
# File 'lib/iterm2/protocol/image_sequence.rb', line 36 attribute(:width) { |value| value.nil? ? "auto" : value.to_s } |