Sha256: f44e25d581e628f92d24767833ee225e4e9d7ab77db93b8a0d3cb71b324ad9c6

Contents?: true

Size: 407 Bytes

Versions: 2

Compression:

Stored size: 407 Bytes

Contents

module EenyMeeny
  class Variation
    attr_reader :id, :name, :weight, :options

    def initialize(id, name: '', weight: 1, **options)
      @id = id
      @name = name
      @weight = weight
      @options = options
    end

    def marshal_dump
      [@id, { name: @name, weight: @weight, **@options }]
    end

    def marshal_load(array)
      send :initialize, array[0], **array[1]
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
eeny-meeny-2.0.0 lib/eeny-meeny/models/variation.rb
eeny-meeny-1.0.0 lib/eeny-meeny/variation.rb