Class: NyanCat::Cat

Inherits:
Object
  • Object
show all
Defined in:
lib/nyan-cat/cat.rb

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Cat

Returns a new instance of Cat.



19
20
21
22
23
24
# File 'lib/nyan-cat/cat.rb', line 19

def initialize(opts = {})
  @frames         = opts.fetch(:frames) { [FRAME1, FRAME2] }
  @trail_length   = opts.fetch(:trail_length) { 9 }
  @colorize_trail = opts.fetch(:colorize) { true }
  @frame_count    = 0
end

Instance Method Details

#tick(frame_count = @frame_count) ⇒ Object



26
27
28
29
# File 'lib/nyan-cat/cat.rb', line 26

def tick(frame_count = @frame_count)
  increment_internal_frame_count
  generate_cat(frame_count)
end