Sha256: 1a3a4b206924889a1d613552ec276e71058268fc968a5c7db8385f16165d3c30

Contents?: true

Size: 677 Bytes

Versions: 3

Compression:

Stored size: 677 Bytes

Contents

module EfoNelfo
  module PostHeadType
    attr_accessor :source

    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

    def [](index)
      lines[index]
    end

    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

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
efo_nelfo-1.3.2 lib/efo_nelfo/post_head_type.rb
efo_nelfo-1.3.1 lib/efo_nelfo/post_head_type.rb
efo_nelfo-1.3.0 lib/efo_nelfo/post_head_type.rb