Skip to content

Commit

Permalink
Change built-in formats to use consistent frames formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrmurach committed Oct 17, 2020
1 parent b843183 commit 508cfc8
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 35 deletions.
77 changes: 43 additions & 34 deletions lib/tty/spinner/formats.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,83 +5,83 @@ module Formats
FORMATS = {
classic: {
interval: 10,
frames: %w{| / - \\}
frames: %w[| / - \\]
},
spin: {
interval: 10,
frames: %w{ }
frames: %w[ ]
},
spin_2: {
interval: 10,
frames: %w{ }
frames: %w[ ]
},
spin_3: {
interval: 10,
frames: %w{ }
frames: %w[ ]
},
spin_4: {
interval: 10,
frames: %w{ }
frames: %w[ ]
},
pulse: {
interval: 10,
frames: %w{ }
frames: %w[ ]
},
pulse_2: {
interval: 15,
frames: %w{ }
frames: %w[ ]
},
pulse_3: {
interval: 20,
frames: '▉▊▋▌▍▎▏▎▍▌▋▊▉'
frames: %w[ ]
},
dots: {
interval: 10,
frames: %w{ }
frames: %w[ ]
},
dots_2: {
interval: 10,
frames: %w{ }
frames: %w[ ]
},
dots_3: {
interval: 10,
frames: %w{ }
frames: %w[ ]
},
dots_4: {
interval: 10,
frames: %w{ }
frames: %w[ ]
},
dots_5: {
interval: 10,
frames: %w{ }
frames: %w[ ]
},
dots_6: {
interval: 10,
frames: %w{ }
frames: %w[ ]
},
dots_7: {
interval: 10,
frames: %w{ }
frames: %w[ ]
},
dots_8: {
interval: 10,
frames: %w{ }
frames: %w[ ]
},
dots_9: {
interval: 10,
frames: %w{ }
frames: %w[ ]
},
dots_10: {
interval: 10,
frames: %w{ }
frames: %w[ ]
},
dots_11: {
interval: 10,
frames: %w{ }
frames: %w[ ]
},
arrow: {
interval: 10,
frames: %w{ }
frames: %w[ ]
},
arrow_pulse: {
interval: 10,
Expand All @@ -96,15 +96,15 @@ module Formats
},
triangle: {
interval: 10,
frames: %w{ }
frames: %w[ ]
},
arc: {
interval: 10,
frames: %w{ }
frames: %w[ ]
},
pipe: {
interval: 10,
frames: %w{ }
frames: %w[ ]
},
bouncing: {
interval: 10,
Expand Down Expand Up @@ -136,43 +136,52 @@ module Formats
},
bounce: {
interval: 10,
frames: %w{ }
frames: %w[ ]
},
box_bounce: {
interval: 10,
frames: %w{ }
frames: %w[ ]
},
box_bounce_2: {
interval: 10,
frames: %w{ }
frames: %w[ ]
},
star: {
interval: 10,
frames: %w{ }
frames: %w[ ]
},
toggle: {
interval: 10,
frames: %w{ }
frames: %w[ ]
},
balloon: {
interval: 10,
frames: %w{ . o O @ * }
frames: [" ", ".", "o", "O", "@", "*", " "]
},
balloon_2: {
interval: 10,
frames: %w{. o O ° O o . }
frames: %w[. o O ° O o .]
},
flip: {
interval: 10,
frames: '-◡⊙-◠'
frames: %w[- - ]
},
burger: {
interval: 6,
frames: %w{ }
frames: %w[ ]
},
dance: {
interval: 10,
frames: [">))'>", " >))'>", " >))'>", " >))'>", " >))'>", " <'((<", " <'((<", " <'((<"]
frames: [
">))'>",
" >))'>",
" >))'>",
" >))'>",
" >))'>",
" <'((<",
" <'((<",
" <'((<"
]
},
shark: {
interval: 10,
Expand Down Expand Up @@ -240,6 +249,6 @@ module Formats
"▐⠠ ▌"
]
}
}
}.freeze
end # Formats
end # TTY
2 changes: 1 addition & 1 deletion spec/unit/formats_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

RSpec.describe TTY::Formats::FORMATS do
TTY::Formats::FORMATS.each do |token, properties|
specify "#{token} contains proper defaults properties" do
it "#{token} contains proper defaults properties" do
expect(properties.keys.sort).to eq(%i[frames interval])
end
end
Expand Down

0 comments on commit 508cfc8

Please sign in to comment.