Sha256: c6de99d25c4c674a8fddb60512e2c03b37d2ed9862bd5352de91df17ddd1785a

Contents?: true

Size: 1.78 KB

Versions: 1

Compression:

Stored size: 1.78 KB

Contents

module Vedeu

  # A Cell represents a single square of the terminal.
  #
  class Cell

    # @!attribute [r] background
    # @return [NilClass|String]
    attr_reader :background

    # @!attribute [r] foreground
    # @return [NilClass|String]
    attr_reader :foreground

    # @!attribute [r] style
    # @return [NilClass|Array<Symbol|String>|Symbol|String]
    attr_reader :style

    # @!attribute [r] value
    # @return [NilClass|String]
    attr_reader :value

    # @!attribute [r] x
    # @return [NilClass|Fixnum]
    attr_reader :x

    # @!attribute [r] y
    # @return [NilClass|Fixnum]
    attr_reader :y

    # @param attributes [Hash<Symbol => Array<Symbol|String>, Fixnum, String, Symbol]
    # @option attributes background [NilClass|String]
    # @option attributes foreground [NilClass|String]
    # @option attributes style [NilClass|Array<Symbol|String>|Symbol|String]
    # @option attributes value [NilClass|String]
    # @option attributes x [NilClass|Fixnum]
    # @option attributes y [NilClass|Fixnum]
    # @return [Vedeu::Cell]
    def initialize(attributes = {})
      @background = attributes[:background]
      @foreground = attributes[:foreground]
      @style      = attributes[:style]
      @value      = attributes[:value]
      @x          = attributes[:x]
      @y          = attributes[:y]
    end

    # @param other [Vedeu::Cell]
    # @return [Boolean]
    def ==(other)
      eql?(other)
    end

    # @param other [Vedeu::Cell]
    # @return [Boolean]
    def eql?(other)
      self.class == other.class      &&
      background == other.background &&
      foreground == other.foreground &&
      style      == other.style      &&
      value      == other.value      &&
      x          == other.x          &&
      y          == other.y
    end

  end # Cell

end # Vedeu

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vedeu-0.4.8 lib/vedeu/models/cell.rb