Skip to content

Commit

Permalink
Change to document #update call.
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrmurach committed Jul 14, 2016
1 parent e4689bd commit 2fce756
Showing 1 changed file with 35 additions and 4 deletions.
39 changes: 35 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ Or install it yourself as:
* [2.3 stop](#23-stop)
* [2.4 success](#24-success)
* [2.5 error](#25-error)
* [2.6 reset](#26-reset)
* [2.7 join](#27-join)
* [2.6 update](#26-update)
* [2.7 reset](#27-reset)
* [2.8 join](#28-join)
* [3. Configuration](#3-configuration)
* [3.1 :format](#31-format)
* [3.2 :frames](#32-frames)
Expand Down Expand Up @@ -152,15 +153,45 @@ This will produce:
[✖] Task name (error)
```

### 2.6 reset
### 2.6 update

Use `update` call to dynamically change label name(s).

Provide an arbitrary token name in the message string, such as `:title`

```ruby
spinner = TTY::Spinner.new("[:spinner] :title")
```

and then pass token name and value:

```ruby
spinner.update(title: 'Downloading file1')
```

next start animation:

```ruby
spinner.run { ... }
# => | Downloading file1
```

Once animation finishes you can kick start another one with different name:

```ruby
spinner.update(title: 'Downloading file2')
spinner.run { ... }
```

### 2.7 reset

In order to reset the spinner to its initial frame do:

```ruby
spinner.reset
```

### 2.7 join
### 2.8 join

One way to wait while the spinning animates is to join the thread started with `start` method:

Expand Down

0 comments on commit 2fce756

Please sign in to comment.