Class: TTY::Table::Options

Inherits:
Hash
  • Object
show all
Defined in:
lib/tty/table/options.rb

Overview

Structure for holding table options with indifferent access

Instance Method Summary collapse

Constructor Details

#initialize(hash = {}, &block) ⇒ Options

Returns a new instance of Options.



10
11
12
13
14
15
16
# File 'lib/tty/table/options.rb', line 10

def initialize(hash={}, &block)
  super(&block)

  hash.each do |key, value|
    self[convert_key(key)] = valu
  end
end

Instance Method Details

#[]=(key, value) ⇒ Object



18
19
20
# File 'lib/tty/table/options.rb', line 18

def []=(key, value)
  super(convert_key(key), value)
end

#convert_key(key) ⇒ Object



22
23
24
# File 'lib/tty/table/options.rb', line 22

def convert_key(key)
  key.is_a?(Symbol) ? key.to_s : key
end