Class: Termplot::WidgetDSL::WidgetConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/termplot/dsl/widgets.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#colObject (readonly)

Returns the value of attribute col.



28
29
30
# File 'lib/termplot/dsl/widgets.rb', line 28

def col
  @col
end

#colsObject (readonly)

Returns the value of attribute cols.



28
29
30
# File 'lib/termplot/dsl/widgets.rb', line 28

def cols
  @cols
end

#commandObject (readonly)

Returns the value of attribute command.



28
29
30
# File 'lib/termplot/dsl/widgets.rb', line 28

def command
  @command
end

#debugObject (readonly)

Returns the value of attribute debug.



28
29
30
# File 'lib/termplot/dsl/widgets.rb', line 28

def debug
  @debug
end

#intervalObject (readonly)

Returns the value of attribute interval.



28
29
30
# File 'lib/termplot/dsl/widgets.rb', line 28

def interval
  @interval
end

#rowObject (readonly)

Returns the value of attribute row.



28
29
30
# File 'lib/termplot/dsl/widgets.rb', line 28

def row
  @row
end

#rowsObject (readonly)

Returns the value of attribute rows.



28
29
30
# File 'lib/termplot/dsl/widgets.rb', line 28

def rows
  @rows
end

#titleObject (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

#flattenObject



60
61
62
# File 'lib/termplot/dsl/widgets.rb', line 60

def flatten
  self
end

#positioned_widgetObject



64
65
66
67
68
69
70
# File 'lib/termplot/dsl/widgets.rb', line 64

def positioned_widget
  @positioned_widget ||= PositionedWidget.new(
    row: row,
    col: col,
    widget: 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_optionsObject



76
77
78
# File 'lib/termplot/dsl/widgets.rb', line 76

def producer_options
  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

#widgetObject



72
73
74
# File 'lib/termplot/dsl/widgets.rb', line 72

def widget
  raise "Must be implemented"
end