Class: Termplot::WidgetDSL::WidgetConfig
- Inherits:
-
Object
- Object
- Termplot::WidgetDSL::WidgetConfig
- Defined in:
- lib/termplot/dsl/widgets.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#col ⇒ Object
readonly
Returns the value of attribute col.
-
#cols ⇒ Object
readonly
Returns the value of attribute cols.
-
#command ⇒ Object
readonly
Returns the value of attribute command.
-
#debug ⇒ Object
readonly
Returns the value of attribute debug.
-
#interval ⇒ Object
readonly
Returns the value of attribute interval.
-
#row ⇒ Object
readonly
Returns the value of attribute row.
-
#rows ⇒ Object
readonly
Returns the value of attribute rows.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
- #flatten ⇒ Object
-
#initialize(opts) ⇒ WidgetConfig
constructor
A new instance of WidgetConfig.
- #positioned_widget ⇒ Object
- #post_initialize(opts) ⇒ Object
- #producer_options ⇒ Object
- #set_dimensions(rows, cols, start_row, start_col) ⇒ Object
- #widget ⇒ Object
Constructor Details
#initialize(opts) ⇒ WidgetConfig
Returns a new instance of WidgetConfig.
39 40 41 42 43 44 45 46 47 |
# File 'lib/termplot/dsl/widgets.rb', line 39 def initialize(opts) @title = opts[:title] @command = opts[:command] @interval = opts[:interval] @debug = opts[:debug] post_initialize(opts) end |
Instance Attribute Details
#col ⇒ Object (readonly)
Returns the value of attribute col.
28 29 30 |
# File 'lib/termplot/dsl/widgets.rb', line 28 def col @col end |
#cols ⇒ Object (readonly)
Returns the value of attribute cols.
28 29 30 |
# File 'lib/termplot/dsl/widgets.rb', line 28 def cols @cols end |
#command ⇒ Object (readonly)
Returns the value of attribute command.
28 29 30 |
# File 'lib/termplot/dsl/widgets.rb', line 28 def command @command end |
#debug ⇒ Object (readonly)
Returns the value of attribute debug.
28 29 30 |
# File 'lib/termplot/dsl/widgets.rb', line 28 def debug @debug end |
#interval ⇒ Object (readonly)
Returns the value of attribute interval.
28 29 30 |
# File 'lib/termplot/dsl/widgets.rb', line 28 def interval @interval end |
#row ⇒ Object (readonly)
Returns the value of attribute row.
28 29 30 |
# File 'lib/termplot/dsl/widgets.rb', line 28 def row @row end |
#rows ⇒ Object (readonly)
Returns the value of attribute rows.
28 29 30 |
# File 'lib/termplot/dsl/widgets.rb', line 28 def rows @rows end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
28 29 30 |
# File 'lib/termplot/dsl/widgets.rb', line 28 def title @title end |
Instance Method Details
#flatten ⇒ Object
60 61 62 |
# File 'lib/termplot/dsl/widgets.rb', line 60 def flatten self end |
#positioned_widget ⇒ Object
64 65 66 67 68 69 70 |
# File 'lib/termplot/dsl/widgets.rb', line 64 def @positioned_widget ||= PositionedWidget.new( row: row, col: col, widget: ) end |
#post_initialize(opts) ⇒ Object
49 50 51 |
# File 'lib/termplot/dsl/widgets.rb', line 49 def post_initialize(opts) # Implemented in subclasses end |
#producer_options ⇒ Object
76 77 78 |
# File 'lib/termplot/dsl/widgets.rb', line 76 def ProducerOptions.new(command: command, interval: interval) end |
#set_dimensions(rows, cols, start_row, start_col) ⇒ Object
53 54 55 56 57 58 |
# File 'lib/termplot/dsl/widgets.rb', line 53 def set_dimensions(rows, cols, start_row, start_col) @rows = rows @cols = cols @row = start_row @col = start_col end |
#widget ⇒ Object
72 73 74 |
# File 'lib/termplot/dsl/widgets.rb', line 72 def raise "Must be implemented" end |