Module: DocxReport::DataItem

Included in:
Record, Report
Defined in:
lib/docx_report/data_item.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#fieldsObject (readonly)

Returns the value of attribute fields.



3
4
5
# File 'lib/docx_report/data_item.rb', line 3

def fields
  @fields
end

#imagesObject (readonly)

Returns the value of attribute images.



3
4
5
# File 'lib/docx_report/data_item.rb', line 3

def images
  @images
end

#tablesObject (readonly)

Returns the value of attribute tables.



3
4
5
# File 'lib/docx_report/data_item.rb', line 3

def tables
  @tables
end

Instance Method Details

#add_field(name, value, type = :text, text_direction = :none) ⇒ Object



5
6
7
8
9
# File 'lib/docx_report/data_item.rb', line 5

def add_field(name, value, type = :text, text_direction = :none)
  field = Field.new name, value, type, text_direction
  raise 'duplicate field name' if @fields.any? { |f| f.name == field.name }
  @fields << field
end