Class: Warehouse::Item::Base

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

Direct Known Subclasses

Barcode, Code

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#code_or_barcodeObject

Returns the value of attribute code_or_barcode

Returns:

  • (Object)

    the current value of code_or_barcode



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

def code_or_barcode
  @code_or_barcode
end

#code_typeObject

Returns the value of attribute code_type.



4
5
6
# File 'lib/warehouse/item/base.rb', line 4

def code_type
  @code_type
end

#itemsObject

Returns the value of attribute items.



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

def items
  @items
end

#priceObject

Returns the value of attribute price

Returns:

  • (Object)

    the current value of price



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

def price
  @price
end

#qtyObject

Returns the value of attribute qty

Returns:

  • (Object)

    the current value of qty



3
4
5
# File 'lib/warehouse/item/base.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/base.rb', line 3

def title
  @title
end

Instance Method Details

#barcode?Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/warehouse/item/base.rb', line 7

def barcode?
  code_type == :barcode
end

#code?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/warehouse/item/base.rb', line 11

def code?
  code_type == :code
end

#deep_dupObject



27
28
29
# File 'lib/warehouse/item/base.rb', line 27

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

#persisted?Boolean

給 form 用的

Returns:

  • (Boolean)


32
# File 'lib/warehouse/item/base.rb', line 32

def persisted?; false end

#productObject



33
# File 'lib/warehouse/item/base.rb', line 33

def product; end

#random?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/warehouse/item/base.rb', line 19

def random?
  false
end

#single?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/warehouse/item/base.rb', line 23

def single?
  true
end

#typeObject



15
16
17
# File 'lib/warehouse/item/base.rb', line 15

def type
  'single'
end