Class: TableStructure::Schema::Column::Attrs
- Inherits:
-
Object
- Object
- TableStructure::Schema::Column::Attrs
- Defined in:
- lib/table_structure/schema/column/attrs.rb
Instance Attribute Summary collapse
-
#keys ⇒ Object
readonly
Returns the value of attribute keys.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
Instance Method Summary collapse
-
#initialize(definition, options) ⇒ Attrs
constructor
A new instance of Attrs.
- #name(header_context, table_context) ⇒ Object
- #value(row_context, table_context) ⇒ Object
Constructor Details
#initialize(definition, options) ⇒ Attrs
Returns a new instance of Attrs.
9 10 11 12 13 14 15 |
# File 'lib/table_structure/schema/column/attrs.rb', line 9 def initialize(definition, ) @name = definition[:name] @keys = optimize_size([definition[:key]].flatten, definition[:size]) @value = definition[:value] @size = definition[:size] = end |
Instance Attribute Details
#keys ⇒ Object (readonly)
Returns the value of attribute keys.
7 8 9 |
# File 'lib/table_structure/schema/column/attrs.rb', line 7 def keys @keys end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
7 8 9 |
# File 'lib/table_structure/schema/column/attrs.rb', line 7 def size @size end |
Instance Method Details
#name(header_context, table_context) ⇒ Object
17 18 19 20 |
# File 'lib/table_structure/schema/column/attrs.rb', line 17 def name(header_context, table_context) name = Utils.evaluate_callable(@name, header_context, table_context) optimize_size(name, @size) end |
#value(row_context, table_context) ⇒ Object
22 23 24 25 |
# File 'lib/table_structure/schema/column/attrs.rb', line 22 def value(row_context, table_context) value = Utils.evaluate_callable(@value, row_context, table_context) optimize_size(value, @size) end |