Sha256: e3e1115374e12fa69a8f63f8136f743889851449f141def8aa2e2438a80dbd54

Contents?: true

Size: 455 Bytes

Versions: 6

Compression:

Stored size: 455 Bytes

Contents

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

module Gemwarrior
  class Entity
    # CONSTANTS
    WRAP_WIDTH = 80

    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 = WRAP_WIDTH)
      super s.gsub(/(.{1,#{width}})(\s+|\Z)/, "\\1\n") unless s.nil?
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
gemwarrior-0.10.5 lib/gemwarrior/entities/entity.rb
gemwarrior-0.10.4 lib/gemwarrior/entities/entity.rb
gemwarrior-0.10.2 lib/gemwarrior/entities/entity.rb
gemwarrior-0.10.1 lib/gemwarrior/entities/entity.rb
gemwarrior-0.10.0 lib/gemwarrior/entities/entity.rb
gemwarrior-0.9.39 lib/gemwarrior/entities/entity.rb