Class: TableStructure::Schema::Column::Attrs

Inherits:
Object
  • Object
show all
Defined in:
lib/table_structure/schema/column/attrs.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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, options)
  @name = definition[:name]
  @key = definition[:key]
  @value = definition[:value]
  @size = definition[:size]
  @options = options
end

Instance Attribute Details

#keyObject (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

#sizeObject (readonly)

Returns the value of attribute size.



7
8
9
# File 'lib/table_structure/schema/column/attrs.rb', line 7

def size
  @size
end

#vlaueObject (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



27
28
29
30
# File 'lib/table_structure/schema/column/attrs.rb', line 27

def value(row_context, table_context)
  value = Utils.evaluate_callable(@value, row_context, table_context)
  optimize_size(value)
end