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
A new instance of Column.
- #to_html ⇒ Object
Constructor Details
#initialize(row, index, xml_data) ⇒ Column
Returns a new instance of Column.
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/asker/data/column.rb', line 12 def initialize(row, index, xml_data) @row = row @index = index @id = @row.id + '.' + @index.to_s @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.
10 11 12 |
# File 'lib/asker/data/column.rb', line 10 def id @id end |
#index ⇒ Object (readonly)
Returns the value of attribute index.
10 11 12 |
# File 'lib/asker/data/column.rb', line 10 def index @index end |
#lang ⇒ Object (readonly)
Returns the value of attribute lang.
10 11 12 |
# File 'lib/asker/data/column.rb', line 10 def lang @lang end |
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
10 11 12 |
# File 'lib/asker/data/column.rb', line 10 def raw @raw end |
#row ⇒ Object (readonly)
Returns the value of attribute row.
10 11 12 |
# File 'lib/asker/data/column.rb', line 10 def row @row end |
#simple ⇒ Object (readonly)
Returns the value of attribute simple.
10 11 12 |
# File 'lib/asker/data/column.rb', line 10 def simple @simple end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
10 11 12 |
# File 'lib/asker/data/column.rb', line 10 def type @type end |
Instance Method Details
#to_html ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/asker/data/column.rb', line 23 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>" else return "ERROR type #{@type}" end end |