Class: PostRunner::FlexiTable::Attributes

Inherits:
Object
  • Object
show all
Defined in:
lib/postrunner/FlexiTable.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attrs = {}) ⇒ Attributes

Returns a new instance of Attributes.



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/postrunner/FlexiTable.rb', line 11

def initialize(attrs = {})
  @min_terminal_width = nil
  @halign = nil

  attrs.each do |name, value|
    ivar_name = '@' + name.to_s
    unless instance_variable_defined?(ivar_name)
      Log.fatal "Unsupported attribute #{name}"
    end
    instance_variable_set(ivar_name, value)
  end
end

Instance Attribute Details

#halignObject

Returns the value of attribute halign.



9
10
11
# File 'lib/postrunner/FlexiTable.rb', line 9

def halign
  @halign
end

#min_terminal_widthObject

Returns the value of attribute min_terminal_width.



9
10
11
# File 'lib/postrunner/FlexiTable.rb', line 9

def min_terminal_width
  @min_terminal_width
end

Instance Method Details

#[](name) ⇒ Object



24
25
26
27
28
29
# File 'lib/postrunner/FlexiTable.rb', line 24

def [](name)
  ivar_name = '@' + name.to_s
  return nil unless instance_variable_defined?(ivar_name)

  instance_variable_get(ivar_name)
end