Class: Xlsxrb::Elements::Column
- Inherits:
-
Data
- Object
- Data
- Xlsxrb::Elements::Column
- Defined in:
- lib/xlsxrb/elements/column.rb,
sig/generated/xlsxrb/elements/column.rbs
Overview
Represents column formatting in a worksheet. index is 0-based.
Instance Attribute Summary collapse
-
#custom_width ⇒ Object
readonly
Returns the value of attribute custom_width.
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#hidden ⇒ Object
readonly
Returns the value of attribute hidden.
-
#index ⇒ Object
readonly
Returns the value of attribute index.
-
#outline_level ⇒ Object
readonly
Returns the value of attribute outline_level.
-
#unmapped_data ⇒ Object
readonly
Returns the value of attribute unmapped_data.
-
#width ⇒ Object
readonly
Returns the value of attribute width.
Class Method Summary collapse
- .members ⇒ [ :index, :width, :hidden, :custom_width, :outline_level, :unmapped_data, :errors ]
- .new ⇒ Object
- .validate(index) ⇒ Object
Instance Method Summary collapse
-
#initialize(index:, width: nil, hidden: false, custom_width: false, outline_level: nil, unmapped_data: {}, errors: nil) ⇒ Column
constructor
A new instance of Column.
- #members ⇒ [ :index, :width, :hidden, :custom_width, :outline_level, :unmapped_data, :errors ]
- #valid? ⇒ Boolean
Constructor Details
#initialize(index:, width: nil, hidden: false, custom_width: false, outline_level: nil, unmapped_data: {}, errors: nil) ⇒ Column
Returns a new instance of Column.
10 11 12 13 14 15 16 |
# File 'lib/xlsxrb/elements/column.rb', line 10 def initialize(index:, width: nil, hidden: false, custom_width: false, outline_level: nil, unmapped_data: {}, errors: nil) computed_errors = errors || self.class.validate(index) super(index: index, width: width, hidden: hidden, custom_width: custom_width, outline_level: outline_level, unmapped_data: unmapped_data, errors: computed_errors.freeze) end |
Instance Attribute Details
#custom_width ⇒ Object (readonly)
Returns the value of attribute custom_width
9 10 11 |
# File 'lib/xlsxrb/elements/column.rb', line 9 def custom_width @custom_width end |
#errors ⇒ Object (readonly)
Returns the value of attribute errors
9 10 11 |
# File 'lib/xlsxrb/elements/column.rb', line 9 def errors @errors end |
#hidden ⇒ Object (readonly)
Returns the value of attribute hidden
9 10 11 |
# File 'lib/xlsxrb/elements/column.rb', line 9 def hidden @hidden end |
#index ⇒ Object (readonly)
Returns the value of attribute index
9 10 11 |
# File 'lib/xlsxrb/elements/column.rb', line 9 def index @index end |
#outline_level ⇒ Object (readonly)
Returns the value of attribute outline_level
9 10 11 |
# File 'lib/xlsxrb/elements/column.rb', line 9 def outline_level @outline_level end |
#unmapped_data ⇒ Object (readonly)
Returns the value of attribute unmapped_data
9 10 11 |
# File 'lib/xlsxrb/elements/column.rb', line 9 def unmapped_data @unmapped_data end |
#width ⇒ Object (readonly)
Returns the value of attribute width
9 10 11 |
# File 'lib/xlsxrb/elements/column.rb', line 9 def width @width end |
Class Method Details
.members ⇒ [ :index, :width, :hidden, :custom_width, :outline_level, :unmapped_data, :errors ]
25 |
# File 'sig/generated/xlsxrb/elements/column.rbs', line 25
def self.members: () -> [ :index, :width, :hidden, :custom_width, :outline_level, :unmapped_data, :errors ]
|
.new(index, width, hidden, custom_width, outline_level, unmapped_data, errors) ⇒ instance .new(index:, width:, hidden:, custom_width:, outline_level:, unmapped_data:, errors:) ⇒ instance
22 23 |
# File 'sig/generated/xlsxrb/elements/column.rbs', line 22
def self.new: (untyped index, untyped width, untyped hidden, untyped custom_width, untyped outline_level, untyped unmapped_data, untyped errors) -> instance
| (index: untyped, width: untyped, hidden: untyped, custom_width: untyped, outline_level: untyped, unmapped_data: untyped, errors: untyped) -> instance
|
.validate(index) ⇒ Object
22 23 24 25 26 27 |
# File 'lib/xlsxrb/elements/column.rb', line 22 def self.validate(index) errs = [] errs << "index must be a non-negative Integer (got #{index.inspect})" if !index.is_a?(Integer) || index.negative? errs << "index must be < 16384 (got #{index}, max column is XFD=16383)" if index.is_a?(Integer) && index >= 16_384 errs end |
Instance Method Details
#members ⇒ [ :index, :width, :hidden, :custom_width, :outline_level, :unmapped_data, :errors ]
27 |
# File 'sig/generated/xlsxrb/elements/column.rbs', line 27
def members: () -> [ :index, :width, :hidden, :custom_width, :outline_level, :unmapped_data, :errors ]
|
#valid? ⇒ Boolean
18 19 20 |
# File 'lib/xlsxrb/elements/column.rb', line 18 def valid? errors.empty? end |