Class: BitBar::Base
- Inherits:
-
Object
- Object
- BitBar::Base
- Defined in:
- lib/bitbar/base.rb
Instance Method Summary collapse
-
#initialize(indent_level = -1,, &block) ⇒ Base
constructor
A new instance of Base.
- #item(*args, &block) ⇒ Object
- #separator ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(indent_level = -1,, &block) ⇒ Base
Returns a new instance of Base.
3 4 5 6 7 |
# File 'lib/bitbar/base.rb', line 3 def initialize(indent_level = -1, &block) @indent_level = indent_level @output = [] instance_eval(&block) if block end |
Instance Method Details
#item(*args, &block) ⇒ Object
13 14 15 |
# File 'lib/bitbar/base.rb', line 13 def item(*args, &block) @output << Item.new(@indent_level + 1, *args, &block) end |
#separator ⇒ Object
9 10 11 |
# File 'lib/bitbar/base.rb', line 9 def separator @output << Separator.new(@indent_level + 1) end |
#to_s ⇒ Object
17 18 19 |
# File 'lib/bitbar/base.rb', line 17 def to_s @output.map(&:to_s).join("\r\n") end |