module EfoNelfo::PostHeadType

Public Class Methods

included(base) click to toggle source
# File lib/efo_nelfo/post_head_type.rb, line 4
def self.included(base)
  base.send :property, :post_type,  alias: :PostType,      limit: 2, default: base.post_type
  base.send :property, :format,     alias: :Format,        limit: 8, default: 'EFONELFO'
  base.send :property, :version,    alias: :Versjon,       limit: 3, default: base.version
end

Public Instance Methods

[](index) click to toggle source
# File lib/efo_nelfo/post_head_type.rb, line 10
def [](index)
  lines[index]
end
add(post_type) click to toggle source
# File lib/efo_nelfo/post_head_type.rb, line 14
def add(post_type)
  if has_association? post_type
    find_association(post_type) << post_type
  else
    if lines.any?
      lines.last.find_association(post_type) << post_type
    end
  end
end