Module: Basil::Barcodes
- Defined in:
- lib/basil/barcodes.rb
Class Method Summary collapse
-
.barcode_files ⇒ Object
list available barcodes files.
-
.barcode_path(string) ⇒ Object
return path for barcode file given a string.
- .barcodes ⇒ Object
-
.gem_libdir ⇒ Object
return a directory with the project libraries.
-
.has_barcode?(string) ⇒ Boolean
returns true if string matches a file in the barcodes directory.
Class Method Details
.barcode_files ⇒ Object
list available barcodes files
10 11 12 |
# File 'lib/basil/barcodes.rb', line 10 def self. Dir[File.join(self.gem_libdir, 'barcodes', '*.csv')] end |
.barcode_path(string) ⇒ Object
return path for barcode file given a string
24 25 26 |
# File 'lib/basil/barcodes.rb', line 24 def self.(string) self..reject { |x| File.basename(x, File.extname(x)) != string }.first rescue nil end |
.barcodes ⇒ Object
14 15 16 |
# File 'lib/basil/barcodes.rb', line 14 def self. self..map { |x| File.basename(x, File.extname(x)) } end |
.gem_libdir ⇒ Object
return a directory with the project libraries
5 6 7 |
# File 'lib/basil/barcodes.rb', line 5 def self.gem_libdir File.dirname(__FILE__) end |
.has_barcode?(string) ⇒ Boolean
returns true if string matches a file in the barcodes directory
19 20 21 |
# File 'lib/basil/barcodes.rb', line 19 def self.(string) self..include? File.basename(string, File.extname(string)) end |