Class: Warehouse::Item::Barcode

Inherits:
Struct
  • Object
show all
Defined in:
lib/warehouse/item/barcode.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#barcodeObject

Returns the value of attribute barcode

Returns:

  • (Object)

    the current value of barcode



3
4
5
# File 'lib/warehouse/item/barcode.rb', line 3

def barcode
  @barcode
end

#qtyObject

Returns the value of attribute qty

Returns:

  • (Object)

    the current value of qty



3
4
5
# File 'lib/warehouse/item/barcode.rb', line 3

def qty
  @qty
end

#titleObject

Returns the value of attribute title

Returns:

  • (Object)

    the current value of title



3
4
5
# File 'lib/warehouse/item/barcode.rb', line 3

def title
  @title
end

Instance Method Details

#barcode?Boolean

Returns:

  • (Boolean)


5
6
7
# File 'lib/warehouse/item/barcode.rb', line 5

def barcode?
  true
end

#code?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/warehouse/item/barcode.rb', line 9

def code?
  false
end

#deep_dupObject



33
34
35
# File 'lib/warehouse/item/barcode.rb', line 33

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

#persisted?Boolean

給 form 用的

Returns:

  • (Boolean)


38
# File 'lib/warehouse/item/barcode.rb', line 38

def persisted?; false end

#productObject



39
# File 'lib/warehouse/item/barcode.rb', line 39

def product; end

#random?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/warehouse/item/barcode.rb', line 17

def random?
  false
end

#single?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/warehouse/item/barcode.rb', line 21

def single?
  true
end

#to_hObject



25
26
27
28
29
30
31
# File 'lib/warehouse/item/barcode.rb', line 25

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

#typeObject



13
14
15
# File 'lib/warehouse/item/barcode.rb', line 13

def type
  'single'
end