Sha256: 4731b7e21d07eb423ea488bdd57945efc3cf3003eeb0e20907cfc498db033e19

Contents?: true

Size: 596 Bytes

Versions: 2

Compression:

Stored size: 596 Bytes

Contents

module Warehouse
  module Item
    Barcode = Struct.new(:barcode, :title, :qty) do

      def barcode?
        true
      end

      def code?
        false
      end

      def type
        'single'
      end

      def random?
        false
      end

      def single?
        true
      end

      def to_h
        {
          'barcode' => barcode,
          'title' => title,
          'qty' => qty
        }
      end

      def deep_dup
        self.class.new(barcode, title, qty)
      end

      # 給 form 用的
      def persisted?; false end
      def product; end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
warehouse_items-1.0.0 lib/warehouse/item/barcode.rb
warehouse_items-0.3.0 lib/warehouse/item/barcode.rb