Class: NattyUI::Table::Column

Inherits:
Attributes::Base show all
Includes:
Attributes::Width
Defined in:
lib/natty-ui/table.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, **kwargs) ⇒ Object (private)



44
45
46
47
48
49
# File 'lib/natty-ui/table.rb', line 44

def method_missing(name, *args, **kwargs)
  return super unless name.end_with?('=')
  return super unless Cell::Attributes.public_method_defined?(name)
  @parent.each_cell_of(@index) { _1.attributes.__send__(name, *args) }
  args[0]
end

Instance Attribute Details

#indexInteger (readonly)

Returns column index.

Returns:

  • (Integer)

    column index



16
17
18
# File 'lib/natty-ui/table.rb', line 16

def index
  @index
end

#max_widthInteger? Originally defined in module Attributes::Width

Maximum element width.

Returns:

  • (Integer, nil)

#min_widthInteger? Originally defined in module Attributes::Width

Minimum element width.

Returns:

  • (Integer, nil)

#widthInteger, ... Originally defined in module Attributes::Width

Element width.

Returns:

  • (Integer)

    dedicated element width

  • (Range)

    width range: #min_width..#max_width

  • (nil)

    when unassigned

Instance Method Details

#to_sObject Also known as: inspect



22
# File 'lib/natty-ui/table.rb', line 22

def to_s = "#{super.chop} @index:#{@index} @width:#{width.inspect}>"

#widthObject



18
19
20
# File 'lib/natty-ui/table.rb', line 18

def width
  @width ||= find_width
end