Module: NattyUI::ProgressHelper

Includes:
WithStatus
Defined in:
lib/natty-ui/progress.rb

Overview

TODO:

This chapter needs more documentation.

Progress indictaor helper used by Features#progress.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#active?true, false (readonly) Originally defined in module WithStatus

Returns whether the element is still active.

Returns:

  • (true, false)

    whether the element is still active

#closed?true, false (readonly) Originally defined in module WithStatus

Returns whether the element is completed.

Returns:

  • (true, false)

    whether the element is completed

#failed?true, false (readonly) Originally defined in module WithStatus

Returns whether the element is completed with failure.

Returns:

  • (true, false)

    whether the element is completed with failure

#maxFloat

Returns:

  • (Float)


34
35
36
# File 'lib/natty-ui/progress.rb', line 34

def max
  @max
end

#statusSymbol? (readonly) Originally defined in module WithStatus

Returns element's current status.

Returns:

  • (Symbol, nil)

    element's current status

#titleString

Returns:

  • (String)


14
15
16
# File 'lib/natty-ui/progress.rb', line 14

def title
  @title
end

#valueFloat

Returns:

  • (Float)


23
24
25
# File 'lib/natty-ui/progress.rb', line 23

def value
  @value
end

Instance Method Details

#failed(*text) {|failed| ... } ⇒ Element Originally defined in module WithStatus

Close the element with a failure.

Parameters:

  • text (#to_s)

    optional message

Yields:

  • optionally, when block is given

Yield Parameters:

Returns:

#ok(*text) ⇒ Element Also known as: done Originally defined in module WithStatus

Close the element.

Parameters:

  • text (#to_s)

    optional message

Returns:

#ok?true, false Originally defined in module WithStatus

Returns whether the element is completed.

Returns:

  • (true, false)

    whether the element is completed

#step(count: 1, title: nil) ⇒ ProgressHelper

Increment #value and/or change #title.

Parameters:

  • count (Integer) (defaults to: 1)

    increment

  • title (#to_s) (defaults to: nil)

    new title

Returns:



52
53
54
55
56
# File 'lib/natty-ui/progress.rb', line 52

def step(count: 1, title: nil)
  @title = title if title
  self.value += count
  self
end