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
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#name(header_context, table_context) ⇒ Object
readonly
Returns the value of attribute name.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
-
#vlaue ⇒ Object
readonly
Returns the value of attribute vlaue.
Instance Method Summary collapse
-
#initialize(definition, options) ⇒ Attrs
constructor
A new instance of Attrs.
- #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
#key ⇒ Object (readonly)
Returns the value of attribute key.
7 8 9 |
# File 'lib/table_structure/schema/column/attrs.rb', line 7 def key @key end |
#name(header_context, table_context) ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/table_structure/schema/column/attrs.rb', line 7 def name @name 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 |
#vlaue ⇒ Object (readonly)
Returns the value of attribute vlaue.
7 8 9 |
# File 'lib/table_structure/schema/column/attrs.rb', line 7 def vlaue @vlaue end |
Instance Method Details
#value(row_context, table_context) ⇒ Object
30 31 32 33 |
# File 'lib/table_structure/schema/column/attrs.rb', line 30 def value(row_context, table_context) value = Utils.evaluate_callable(@value, row_context, table_context) optimize_size(value, @size) end |