Class: CliFormat::Presenter::Base
- Inherits:
-
Object
- Object
- CliFormat::Presenter::Base
- Defined in:
- lib/cli_format/presenter/base.rb
Instance Attribute Summary collapse
-
#empty_message ⇒ Object
writeonly
Sets the attribute empty_message.
-
#header ⇒ Object
Returns the value of attribute header.
-
#rows ⇒ Object
Returns the value of attribute rows.
Instance Method Summary collapse
-
#initialize(options, header, rows) ⇒ Base
constructor
A new instance of Base.
- #show ⇒ Object
Constructor Details
#initialize(options, header, rows) ⇒ Base
Returns a new instance of Base.
5 6 7 8 9 |
# File 'lib/cli_format/presenter/base.rb', line 5 def initialize(, header, rows) @options, @header, @rows = , header, rows @empty_message = "No items found" @buffer = [] end |
Instance Attribute Details
#empty_message=(value) ⇒ Object (writeonly)
Sets the attribute empty_message
4 5 6 |
# File 'lib/cli_format/presenter/base.rb', line 4 def (value) @empty_message = value end |
#header ⇒ Object
Returns the value of attribute header.
3 4 5 |
# File 'lib/cli_format/presenter/base.rb', line 3 def header @header end |
#rows ⇒ Object
Returns the value of attribute rows.
3 4 5 |
# File 'lib/cli_format/presenter/base.rb', line 3 def rows @rows end |
Instance Method Details
#show ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/cli_format/presenter/base.rb', line 11 def show if @rows.empty? puts @empty_message else puts text end end |