Class: Column
- Inherits:
-
Object
- Object
- Column
- Defined in:
- lib/asker/data/column.rb
Overview
Contain data information for every column Params:
-
pRow
- Parent row for this column -
index
- Sequence order (Integer) -
xml_data
- XML input data
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#index ⇒ Object
readonly
Returns the value of attribute index.
-
#lang ⇒ Object
readonly
Returns the value of attribute lang.
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
-
#row ⇒ Object
readonly
Returns the value of attribute row.
-
#simple ⇒ Object
readonly
Returns the value of attribute simple.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(row, index, xml_data) ⇒ Column
constructor
initialize Column.
- #to_html ⇒ Object
Constructor Details
#initialize(row, index, xml_data) ⇒ Column
initialize Column
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/asker/data/column.rb', line 16 def initialize(row, index, xml_data) @row = row @index = index @id = "#{@row.id}.#{@index}" @raw = '' @lang = @row.langs[@index] @type = @row.types[@index] @simple = { lang: true, type: true } read_data_from_xml(xml_data) end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
9 10 11 |
# File 'lib/asker/data/column.rb', line 9 def id @id end |
#index ⇒ Object (readonly)
Returns the value of attribute index.
9 10 11 |
# File 'lib/asker/data/column.rb', line 9 def index @index end |
#lang ⇒ Object (readonly)
Returns the value of attribute lang.
9 10 11 |
# File 'lib/asker/data/column.rb', line 9 def lang @lang end |
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
9 10 11 |
# File 'lib/asker/data/column.rb', line 9 def raw @raw end |
#row ⇒ Object (readonly)
Returns the value of attribute row.
9 10 11 |
# File 'lib/asker/data/column.rb', line 9 def row @row end |
#simple ⇒ Object (readonly)
Returns the value of attribute simple.
9 10 11 |
# File 'lib/asker/data/column.rb', line 9 def simple @simple end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
9 10 11 |
# File 'lib/asker/data/column.rb', line 9 def type @type end |
Instance Method Details
#to_html ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/asker/data/column.rb', line 27 def to_html case @type when 'text' return @raw when 'image_url' return "<img src=\"#{raw}\" alt\=\"image\">" when 'textfile_path' return "<pre>#{raw}</pre>" end "ERROR type #{@type}" end |