Class: Vedeu::Models::Escape Private

Inherits:
Object
  • Object
show all
Defined in:
lib/vedeu/models/escape.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Represents an invisible escape character sequence.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Vedeu::Models::Escape

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Vedeu::Models::Escape.

Parameters:

  • attributes (String) (defaults to: {})

Options Hash (attributes):

  • position (Object)
    Vedeu::Geometry::Position|Array<Fixnum>
  • value (String)


22
23
24
25
26
# File 'lib/vedeu/models/escape.rb', line 22

def initialize(attributes = {})
  defaults.merge!(attributes).each do |key, value|
    instance_variable_set("@#{key}", value)
  end
end

Instance Attribute Details

#valueString (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (String)


13
14
15
# File 'lib/vedeu/models/escape.rb', line 13

def value
  @value
end

Instance Method Details

#cell?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


29
30
31
# File 'lib/vedeu/models/escape.rb', line 29

def cell?
  false
end

#defaultsHash (private)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Hash)


82
83
84
85
86
87
# File 'lib/vedeu/models/escape.rb', line 82

def defaults
  {
    position: [1, 1],
    value:    '',
  }
end

#eql?(other) ⇒ Boolean Also known as: ==

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

An object is equal when its values are the same.

Parameters:

Returns:

  • (Boolean)


46
47
48
# File 'lib/vedeu/models/escape.rb', line 46

def eql?(other)
  self.class == other.class && value == other.value
end

#nullNilClass Also known as: background, colour, foreground, style

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (NilClass)


34
35
36
# File 'lib/vedeu/models/escape.rb', line 34

def null
  nil
end

#positionString

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (String)


52
53
54
# File 'lib/vedeu/models/escape.rb', line 52

def position
  Vedeu::Geometry::Position.coerce(@position)
end

#to_hashHash<void>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return an empty hash as most escape sequences won’t make sense as JSON.

Returns:

  • (Hash<void>)


60
61
62
# File 'lib/vedeu/models/escape.rb', line 60

def to_hash
  {}
end

#to_html(_options = {}) ⇒ String

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return an empty string as most escape sequences won’t make sense as HTML.

Parameters:

  • _options (Hash) (defaults to: {})

    Ignored.

Returns:

  • (String)


69
70
71
# File 'lib/vedeu/models/escape.rb', line 69

def to_html(_options = {})
  ''.freeze
end

#to_sString Also known as: to_str

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (String)


74
75
76
# File 'lib/vedeu/models/escape.rb', line 74

def to_s
  "#{position}#{value}".freeze
end