Sha256: 0fa05863c9531118d906e9c66151eb630d9cd6ccd95425f39cfe44e352f4a573

Contents?: true

Size: 847 Bytes

Versions: 15

Compression:

Stored size: 847 Bytes

Contents

module EfoNelfo
  module V40
    class VX < EfoNelfo::PostType
      property :post_type,  alias: :PostType, limit: 2,  default: post_type
      property :field,      alias: :FeltId,   limit: 10, required: true
      property :value,      alias: :Verdi,    limit: 70, required: true

      FIELD_MAPPINGS = {
        image:     "BILDE",
        weight:    "VEKT",
        dimension: "DIMENSJON",
        fdv:       "FDV",
        hms:       "HMS",
        volume:    "VOLUM"
      }

      FIELD_MAPPINGS.each do |key, field_value|
        # Add methods like def image?; field == 'BILDE'; end
        define_method "#{key}?" do
          field == field_value
        end

        # Add methods like: def image; value if image?; end
        define_method "#{key}" do
          self.value if send("#{key}?")
        end
      end

    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
efo_nelfo-2.0.0 lib/efo_nelfo/v40/vx.rb
efo_nelfo-1.7.0 lib/efo_nelfo/v40/vx.rb
efo_nelfo-1.6.2 lib/efo_nelfo/v40/vx.rb
efo_nelfo-1.6.1 lib/efo_nelfo/v40/vx.rb
efo_nelfo-1.6.0 lib/efo_nelfo/v40/vx.rb
efo_nelfo-1.5.5 lib/efo_nelfo/v40/vx.rb
efo_nelfo-1.5.4 lib/efo_nelfo/v40/vx.rb
efo_nelfo-1.5.3 lib/efo_nelfo/v40/vx.rb
efo_nelfo-1.5.2 lib/efo_nelfo/v40/vx.rb
efo_nelfo-1.5.1 lib/efo_nelfo/v40/vx.rb
efo_nelfo-1.5.0 lib/efo_nelfo/v40/vx.rb
efo_nelfo-1.4.0 lib/efo_nelfo/v40/vx.rb
efo_nelfo-1.3.2 lib/efo_nelfo/v40/vx.rb
efo_nelfo-1.3.1 lib/efo_nelfo/v40/vx.rb
efo_nelfo-1.3.0 lib/efo_nelfo/v40/vx.rb