Module: Hanoi::Jane

Defined in:
lib/hanoi/jane.rb,
lib/hanoi/jane/cli.rb,
lib/hanoi/jane/config.rb,
lib/hanoi/jane/version.rb,
lib/hanoi/jane/towers/towers.rb,
lib/hanoi/jane/animation/lifter.rb,
lib/hanoi/jane/animation/dropper.rb,
lib/hanoi/jane/formatters/matrix.rb,
lib/hanoi/jane/formatters/console.rb,
lib/hanoi/jane/animation/animation.rb,
lib/hanoi/jane/towers/stack_finders.rb,
lib/hanoi/jane/towers/animated_towers.rb,
lib/hanoi/jane/animation/padded_stacks.rb,
lib/hanoi/jane/towers/constrained_towers.rb

Defined Under Namespace

Modules: ConstrainedStackFinder, Formatters, StackFinder Classes: AnimatedTowers, Animation, CLI, Config, ConstrainedTowers, Dropper, Frame, HanoiException, Lifter, PaddedStacks, SearchException, Towers

Constant Summary collapse

VERSION =
'0.3.0'

Class Method Summary collapse

Class Method Details

.hit_phat(stacks, value, phat) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/hanoi/jane.rb', line 27

def self.hit_phat stacks, value, phat
  matrix = Formatters::Matrix.new do |m|
    m.stacks = stacks
    m.digits = value
  end
  matrix.populate

  url = "http://#{phat}/lights"
  payload = {
    matrix: matrix
  }
  headers = {
    'Content-Type' => 'application/json',
    'Accept' => 'application/json'
  }

  HTTParty.patch(url, body: payload.to_json, headers: headers)
end