Class: NattyUI::Table::Column
- Inherits:
-
Attributes::Base
- Object
- Attributes::Base
- NattyUI::Table::Column
- Includes:
- Attributes::Width
- Defined in:
- lib/natty-ui/table.rb
Instance Attribute Summary collapse
-
#index ⇒ Integer
readonly
Column index.
-
#max_width ⇒ Integer?
included
from Attributes::Width
Maximum element width.
-
#min_width ⇒ Integer?
included
from Attributes::Width
Minimum element width.
-
#width ⇒ Integer, ...
included
from Attributes::Width
Element width.
Instance Method Summary collapse
- #to_s ⇒ Object (also: #inspect)
- #width ⇒ Object
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
#index ⇒ Integer (readonly)
Returns column index.
16 17 18 |
# File 'lib/natty-ui/table.rb', line 16 def index @index end |
#max_width ⇒ Integer? Originally defined in module Attributes::Width
Maximum element width.
#min_width ⇒ Integer? Originally defined in module Attributes::Width
Minimum element width.
#width ⇒ Integer, ... Originally defined in module Attributes::Width
Element width.
Instance Method Details
#to_s ⇒ Object Also known as: inspect
22 |
# File 'lib/natty-ui/table.rb', line 22 def to_s = "#{super.chop} @index:#{@index} @width:#{width.inspect}>" |
#width ⇒ Object
18 19 20 |
# File 'lib/natty-ui/table.rb', line 18 def width @width ||= find_width end |