Sha256: fc8e54b09a65686151f67639227287b6da30391c577e72bbde57a1108d7c473a

Contents?: true

Size: 583 Bytes

Versions: 1

Compression:

Stored size: 583 Bytes

Contents

module Warehouse
  module Item
    Base = Struct.new(:code_or_barcode, :title, :qty, :price) do
      attr_accessor :code_type
      attr_accessor :items

      def barcode?
        code_type == :barcode
      end

      def code?
        code_type == :code
      end

      def type
        'single'
      end

      def random?
        false
      end

      def single?
        true
      end

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

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
warehouse_items-0.2.0 lib/warehouse/item/base.rb