module VisualizeRuby::Touchable

Attributes

touched[R]

Public Instance Methods

post_initialize(**args) click to toggle source
Calls superclass method
# File lib/visualize_ruby/touchable.rb, line 3
def post_initialize(**args)
  self.class.add_names(:touched_display, :step_display)
  @steps   = []
  @touched = 0
  super if defined? super
end
step_display() click to toggle source
# File lib/visualize_ruby/touchable.rb, line 22
def step_display
  unless @steps.empty?
    "step: #{@steps.join(", ")}"
  end
end
touch(color, step: nil) click to toggle source
# File lib/visualize_ruby/touchable.rb, line 10
def touch(color, step: nil)
  @steps << step
  options.merge!(color: color)
  @touched += 1
end
touched_display() click to toggle source
# File lib/visualize_ruby/touchable.rb, line 16
def touched_display
  unless [0, 1].include?(@touched)
    "(called: #{@touched})"
  end
end