Module: EfoNelfo::PostHeadType

Included in:
V40::BH, V40::CH, V40::RH, V40::VH
Defined in:
lib/efo_nelfo/post_head_type.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



4
5
6
7
8
# 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

Instance Method Details

#[](index) ⇒ Object



10
11
12
# File 'lib/efo_nelfo/post_head_type.rb', line 10

def [](index)
  lines[index]
end

#add(post_type) ⇒ Object



14
15
16
17
18
19
20
21
22
# 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