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) ⇒ Attrs
constructor
A new instance of Attrs.
- #name(context, table_context) ⇒ Object
- #value(context, table_context) ⇒ Object
Constructor Details
#initialize(definition) ⇒ Attrs
Returns a new instance of Attrs.
9 10 11 12 13 14 |
# 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(context, table_context) ⇒ Object
16 17 18 19 |
# File 'lib/table_structure/schema/column/attrs.rb', line 16 def name(context, table_context) name = Utils.evaluate_callable(@name, context, table_context) optimize_size(name, @size) end |
#value(context, table_context) ⇒ Object
21 22 23 24 |
# File 'lib/table_structure/schema/column/attrs.rb', line 21 def value(context, table_context) value = Utils.evaluate_callable(@value, context, table_context) optimize_size(value, @size) end |