Module: NattyUI::WithStatus

Included in:
ProgressHelper, Section, Task
Defined in:
lib/natty-ui/element.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#statusObject (readonly)

Returns the value of attribute status.



50
51
52
# File 'lib/natty-ui/element.rb', line 50

def status
  @status
end

Instance Method Details

#active?Boolean

Returns:

  • (Boolean)


51
# File 'lib/natty-ui/element.rb', line 51

def active? = @status.nil?

#closed?Boolean

Returns:

  • (Boolean)


52
# File 'lib/natty-ui/element.rb', line 52

def closed? = !active?

#failed(*text, &block) ⇒ Object



65
66
67
68
69
70
71
72
# File 'lib/natty-ui/element.rb', line 65

def failed(*text, &block)
  return self if @state
  _failed
  @state = :failed
  text = [@title] if text.empty? && @title
  @parent.failed(*text, &block)
  self
end

#failed?Boolean

Returns:

  • (Boolean)


54
# File 'lib/natty-ui/element.rb', line 54

def failed? = @state == :failed

#ok(*text) ⇒ Object Also known as: done



56
57
58
59
60
61
62
# File 'lib/natty-ui/element.rb', line 56

def ok(*text)
  return self if @state
  text = [@title] if text.empty? && @title
  _done(text)
  @state = :ok
  self
end

#ok?Boolean

Returns:

  • (Boolean)


53
# File 'lib/natty-ui/element.rb', line 53

def ok? = @state == :ok