Class: HXL::HXLColumn

Inherits:
Object
  • Object
show all
Defined in:
lib/hxl/hxl_column.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hxl_tag = nil, language_code = nil) ⇒ HXLColumn

Returns a new instance of HXLColumn.



5
6
7
8
9
# File 'lib/hxl/hxl_column.rb', line 5

def initialize(hxl_tag = nil, language_code = nil)
  @hxl_tag = hxl_tag
  @language_code = language_code
  @header_text = self.pretty_tag
end

Instance Attribute Details

#header_textObject (readonly)

Returns the value of attribute header_text.



3
4
5
# File 'lib/hxl/hxl_column.rb', line 3

def header_text
  @header_text
end

#hxl_tagObject (readonly)

Returns the value of attribute hxl_tag.



3
4
5
# File 'lib/hxl/hxl_column.rb', line 3

def hxl_tag
  @hxl_tag
end

#language_codeObject (readonly)

Returns the value of attribute language_code.



3
4
5
# File 'lib/hxl/hxl_column.rb', line 3

def language_code
  @language_code
end

Instance Method Details

#pretty_tagObject



11
12
13
14
15
16
17
18
19
# File 'lib/hxl/hxl_column.rb', line 11

def pretty_tag
  return '' unless @hxl_tag

  @hxl_tag
    .gsub(/^#/, '')
    .gsub(/_(date|deg|id|link|num)$/, '')
    .gsub('_', ' ')
    .upcase
end