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



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

def active? = @status.nil?

#closed?Boolean



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

def closed? = !active?

#failed(*text, &block) ⇒ Object



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

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



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

def failed? = @state == :failed

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



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

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

#ok?Boolean



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

def ok? = @state == :ok