Sha256: d5d3193a546cc099925bed61ece6d3190d9e020305a474e3855dd728be641ce8

Contents?: true

Size: 1.52 KB

Versions: 11

Compression:

Stored size: 1.52 KB

Contents

module Vedeu

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

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

    # @!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

    # Returns a new instance of Vedeu::Cell.
    #
    # @param attributes [Hash<Symbol => Array<Symbol|String>,
    #                                   Fixnum, String, Symbol]
    # @option attributes colour [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 = {})
      @colour = attributes[:colour]
      @style  = attributes[:style]
      @value  = attributes[:value]
      @x      = attributes[:x]
      @y      = attributes[:y]
    end

    # An object is equal when its values are the same.
    #
    # @param other [Vedeu::Cell]
    # @return [Boolean]
    def eql?(other)
      self.class == other.class && colour == other.colour &&
        style == other.style && value == other.value && x == other.x &&
        y == other.y
    end
    alias_method :==, :eql?

  end # Cell

end # Vedeu

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
vedeu-0.4.32 lib/vedeu/models/cell.rb
vedeu-0.4.31 lib/vedeu/models/cell.rb
vedeu-0.4.30 lib/vedeu/models/cell.rb
vedeu-0.4.29 lib/vedeu/models/cell.rb
vedeu-0.4.28 lib/vedeu/models/cell.rb
vedeu-0.4.27 lib/vedeu/models/cell.rb
vedeu-0.4.26 lib/vedeu/models/cell.rb
vedeu-0.4.25 lib/vedeu/models/cell.rb
vedeu-0.4.24 lib/vedeu/models/cell.rb
vedeu-0.4.23 lib/vedeu/models/cell.rb
vedeu-0.4.22 lib/vedeu/models/cell.rb