Class: BitBar::Item

Inherits:
Base
  • Object
show all
Defined in:
lib/bitbar/item.rb

Defined Under Namespace

Classes: Options

Instance Method Summary collapse

Methods inherited from Base

#item, #separator

Constructor Details

#initialize(*args, &block) ⇒ Item

Returns a new instance of Item.



15
16
17
18
19
# File 'lib/bitbar/item.rb', line 15

def initialize(*args, &block)
  @opts = Options.new(args.extract_options!)
  @indent_level, @title = args
  super(@indent_level, &block)
end

Instance Method Details

#to_sObject



21
22
23
24
# File 'lib/bitbar/item.rb', line 21

def to_s
  prefix = ("--" * @indent_level) + @title.to_s
  [@opts.any? ? [prefix, @opts].join("|") : prefix, *@output.map(&:to_s)].join("\r\n")
end