Class: Mosespa::Puts
- Inherits:
-
Object
- Object
- Mosespa::Puts
- Defined in:
- lib/mosespa.rb
Instance Method Summary collapse
-
#initialize ⇒ Puts
constructor
A new instance of Puts.
- #puts(author, text) ⇒ Object
Constructor Details
#initialize ⇒ Puts
Returns a new instance of Puts.
92 93 94 95 96 97 98 |
# File 'lib/mosespa.rb', line 92 def initialize() @colors = Hash.new @available_colors = Queue.new String.colors .select{ |c| not [:black, :light_black, :white].include? c} .each { |c| @available_colors.push c } end |
Instance Method Details
#puts(author, text) ⇒ Object
100 101 102 103 104 105 106 107 108 |
# File 'lib/mosespa.rb', line 100 def puts(, text) unless @colors.has_key? a_color = @available_colors.pop @colors[] = a_color end c = @colors[] = .colorize( c ) $stdout.puts "#{}: #{text}" end |