Class: Warehouse::Item::Code

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#codeObject

Returns the value of attribute code

Returns:

  • (Object)

    the current value of code



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

def code
  @code
end

#priceObject

Returns the value of attribute price

Returns:

  • (Object)

    the current value of price



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

def title
  @title
end

Instance Method Details

#barcode?Boolean

Returns:

  • (Boolean)


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

def barcode?
  false
end

#code?Boolean

Returns:

  • (Boolean)


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

def code?
  true
end

#deep_dupObject



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

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

#persisted?Boolean

給 form 用的

Returns:

  • (Boolean)


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

def persisted?; false end

#productObject



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

def product; end

#random?Boolean

Returns:

  • (Boolean)


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

def random?
  false
end

#single?Boolean

Returns:

  • (Boolean)


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

def single?
  true
end

#to_hObject



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

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

#typeObject



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

def type
  'single'
end