Class: Faker::Barcode
Constant Summary
Constants inherited from Base
Faker::Base::LLetters, Faker::Base::Letters, Faker::Base::NOT_GIVEN, Faker::Base::Numbers, Faker::Base::ULetters
Class Method Summary collapse
-
.ean(length = 8) ⇒ Object
Returns a EAN 8 or 13 digit format barcode number with check digit @return [String].
-
.ean_with_composite_symbology(length = 8) ⇒ Object
Returns a EAN 8 or 13 digit format barcode number with composite string attached with check digit @return [String].
-
.isbn ⇒ Object
Returns a ISBN format barcode number with check digit @return [String].
-
.ismn ⇒ Object
Returns a ISMN format barcode number with check digit @return [String].
-
.issn ⇒ Object
Returns a ISSN format barcode number with check digit @return [String].
-
.upc_a ⇒ Object
Returns a UPC_A format barcode number with check digit @return [String].
-
.upc_a_with_composite_symbology ⇒ Object
Returns a UPC_A format barcode number with composite string attached with check digit @return [String].
-
.upc_e ⇒ Object
Returns a UPC_E format barcode number with check digit @return [String].
-
.upc_e_with_composite_symbology ⇒ Object
Returns a UPC_E format barcode number with composite string attached with check digit @return [String].
Methods inherited from Base
bothify, disable_enforce_available_locales, fetch, fetch_all, flexible, generate, letterify, method_missing, numerify, parse, rand, rand_in_range, regexify, resolve, respond_to_missing?, sample, shuffle, shuffle!, translate, unique, with_locale
Class Method Details
.ean(length = 8) ⇒ Object
16 17 18 |
# File 'lib/faker/default/barcode.rb', line 16 def ean(length = 8) ("barcode.ean_#{Integer(length)}") end |
.ean_with_composite_symbology(length = 8) ⇒ Object
Returns a EAN 8 or 13 digit format barcode number with composite string attached with check digit
@return [String]
@example
Faker::Barcode.ean_with_composite_sumbology => "41007624|JHOC6649"
Faker::Barcode.ean_with_composite_sumbology(8) => "38357961|XUYJ3266"
Faker::Barcode.ean_with_composite_sumbology(13) => "9530722443911|CKHWQHID"
30 31 32 |
# File 'lib/faker/default/barcode.rb', line 30 def ean_with_composite_symbology(length = 8) "#{ean(length)}|#{bothify(parse('barcode.composite_symbol'))}" end |
.isbn ⇒ Object
90 91 92 |
# File 'lib/faker/default/barcode.rb', line 90 def isbn ('barcode.isbn') end |
.ismn ⇒ Object
102 103 104 |
# File 'lib/faker/default/barcode.rb', line 102 def ismn ('barcode.ismn') end |
.issn ⇒ Object
114 115 116 |
# File 'lib/faker/default/barcode.rb', line 114 def issn ('barcode.issn') end |
.upc_a ⇒ Object
42 43 44 |
# File 'lib/faker/default/barcode.rb', line 42 def upc_a ('barcode.upc_a') end |
.upc_a_with_composite_symbology ⇒ Object
66 67 68 |
# File 'lib/faker/default/barcode.rb', line 66 def upc_a_with_composite_symbology "#{upc_a}|#{bothify(parse('barcode.composite_symbol'))}" end |
.upc_e ⇒ Object
54 55 56 |
# File 'lib/faker/default/barcode.rb', line 54 def upc_e ('barcode.upc_e') end |
.upc_e_with_composite_symbology ⇒ Object
78 79 80 |
# File 'lib/faker/default/barcode.rb', line 78 def upc_e_with_composite_symbology "#{upc_e}|#{bothify(parse('barcode.composite_symbol'))}" end |