Module: NattyUI::WithStatus
- Included in:
- ProgressHelper, Section, Task
- Defined in:
- lib/natty-ui/element.rb
Instance Attribute Summary collapse
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
- #active? ⇒ Boolean
- #closed? ⇒ Boolean
- #failed(*text, &block) ⇒ Object
- #failed? ⇒ Boolean
- #ok(*text) ⇒ Object (also: #done)
- #ok? ⇒ Boolean
Instance Attribute Details
#status ⇒ Object (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
51 |
# File 'lib/natty-ui/element.rb', line 51 def active? = @status.nil? |
#closed? ⇒ 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
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
53 |
# File 'lib/natty-ui/element.rb', line 53 def ok? = @state == :ok |