Class: TecDoc::ArticleAttribute

Inherits:
Object
  • Object
show all
Defined in:
lib/tec_doc/article_attribute.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ ArticleAttribute

Returns a new instance of ArticleAttribute.



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/tec_doc/article_attribute.rb', line 5

def initialize(attributes = {})
  attributes.each do |name, value|
    send("#{name.to_s.gsub(/^attr_/, '')}=", value)
  end

  @id             = @id.to_i                       if @id
  @value_id       = @value_id.to_i                 if @value_id
  @value          = DateParser.new(@value).to_date if @type == "D"
  @is_interval    = (@is_interval == "true")       if @is_interval.is_a?(String)
  @is_conditional = (@is_conditional == "true")    if @is_conditional.is_a?(String)
end

Instance Attribute Details

#block_noObject

Returns the value of attribute block_no.



3
4
5
# File 'lib/tec_doc/article_attribute.rb', line 3

def block_no
  @block_no
end

#idObject

Returns the value of attribute id.



3
4
5
# File 'lib/tec_doc/article_attribute.rb', line 3

def id
  @id
end

#is_conditionalObject

Returns the value of attribute is_conditional.



3
4
5
# File 'lib/tec_doc/article_attribute.rb', line 3

def is_conditional
  @is_conditional
end

#is_intervalObject

Returns the value of attribute is_interval.



3
4
5
# File 'lib/tec_doc/article_attribute.rb', line 3

def is_interval
  @is_interval
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/tec_doc/article_attribute.rb', line 3

def name
  @name
end

#short_nameObject

Returns the value of attribute short_name.



3
4
5
# File 'lib/tec_doc/article_attribute.rb', line 3

def short_name
  @short_name
end

#successor_idObject

Returns the value of attribute successor_id.



3
4
5
# File 'lib/tec_doc/article_attribute.rb', line 3

def successor_id
  @successor_id
end

#typeObject

Returns the value of attribute type.



3
4
5
# File 'lib/tec_doc/article_attribute.rb', line 3

def type
  @type
end

#unitObject

Returns the value of attribute unit.



3
4
5
# File 'lib/tec_doc/article_attribute.rb', line 3

def unit
  @unit
end

#valueObject

Returns the value of attribute value.



3
4
5
# File 'lib/tec_doc/article_attribute.rb', line 3

def value
  @value
end

#value_idObject

Returns the value of attribute value_id.



3
4
5
# File 'lib/tec_doc/article_attribute.rb', line 3

def value_id
  @value_id
end