Class: Termplot::FileConfig

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ FileConfig

Returns a new instance of FileConfig.



8
9
10
11
12
13
14
# File 'lib/termplot/file_config.rb', line 8

def initialize(options)
  @options = options
  @path = options.file
  @rows = options.rows
  @cols = options.cols
  @widget_configs = nil
end

Instance Attribute Details

#colsObject (readonly)

Returns the value of attribute cols.



7
8
9
# File 'lib/termplot/file_config.rb', line 7

def cols
  @cols
end

#optionsObject (readonly)

Returns the value of attribute options.



7
8
9
# File 'lib/termplot/file_config.rb', line 7

def options
  @options
end

#rowsObject (readonly)

Returns the value of attribute rows.



7
8
9
# File 'lib/termplot/file_config.rb', line 7

def rows
  @rows
end

#widget_configsObject (readonly)

Returns the value of attribute widget_configs.



7
8
9
# File 'lib/termplot/file_config.rb', line 7

def widget_configs
  @widget_configs
end

Instance Method Details

#parse_configObject



16
17
18
19
20
21
22
23
# File 'lib/termplot/file_config.rb', line 16

def parse_config
  code = File.read(path)
  top_level_panel = Termplot::DSL::Col.new(options)
  top_level_panel.instance_eval(code)

  @widget_configs = resolve_widget_positions(top_level_panel)
  self
end

#positioned_widgetsObject



25
26
27
# File 'lib/termplot/file_config.rb', line 25

def positioned_widgets
  widget_configs.map(&:positioned_widget)
end