Sha256: 854920cf4eb281a74dd790e943a3c195362c856a1a030c5bfef6a773e3627619

Contents?: true

Size: 474 Bytes

Versions: 3

Compression:

Stored size: 474 Bytes

Contents

# lib/gemwarrior/entities/entity.rb
# Base class for an interactable object

require_relative '../game_options'

module Gemwarrior
  class Entity
    attr_accessor :name, :description

    def status
      status_text =  name.ljust(26).upcase.colorize(:green)
      status_text << "#{description}\n".colorize(:white)
    end

    def puts(s = '', width = GameOptions.data['wrap_width'])
      super s.gsub(/(.{1,#{width}})(\s+|\Z)/, "\\1\n") unless s.nil?
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
gemwarrior-0.10.8 lib/gemwarrior/entities/entity.rb
gemwarrior-0.10.7 lib/gemwarrior/entities/entity.rb
gemwarrior-0.10.6 lib/gemwarrior/entities/entity.rb