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.
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/asker/data/column.rb', line 17 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.
11 12 13 |
# File 'lib/asker/data/column.rb', line 11 def id @id end |
#index ⇒ Object (readonly)
Returns the value of attribute index.
11 12 13 |
# File 'lib/asker/data/column.rb', line 11 def index @index end |
#lang ⇒ Object (readonly)
Returns the value of attribute lang.
11 12 13 |
# File 'lib/asker/data/column.rb', line 11 def lang @lang end |
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
11 12 13 |
# File 'lib/asker/data/column.rb', line 11 def raw @raw end |
#row ⇒ Object (readonly)
Returns the value of attribute row.
11 12 13 |
# File 'lib/asker/data/column.rb', line 11 def row @row end |
#simple ⇒ Object (readonly)
Returns the value of attribute simple.
11 12 13 |
# File 'lib/asker/data/column.rb', line 11 def simple @simple end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
11 12 13 |
# File 'lib/asker/data/column.rb', line 11 def type @type end |
Instance Method Details
#to_html ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/asker/data/column.rb', line 28 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 |