Class: RGhost::Barcode::Parameter

Inherits:
PsObject
  • Object
show all
Defined in:
lib/rghost_barcode/rghost_barcode_base.rb

Direct Known Subclasses

Base, Border, Guard, Text

Instance Method Summary collapse

Constructor Details

#initialize(options = nil) ⇒ Parameter

Returns a new instance of Parameter.



5
6
7
8
9
# File 'lib/rghost_barcode/rghost_barcode_base.rb', line 5

def initialize(options=nil)
  @options=options
  @params=[]
  make() if options
end

Instance Method Details

#add(key, value) ⇒ Object



14
15
16
# File 'lib/rghost_barcode/rghost_barcode_base.rb', line 14

def add(key,value)
  @params << "#{key}=#{value}" if value
end

#add_color(key, value) ⇒ Object



18
19
20
# File 'lib/rghost_barcode/rghost_barcode_base.rb', line 18

def add_color(key,value)
  add(key, value.to_s.gsub(/[^0-9A-F]/,'') )
end

#add_single(entry) ⇒ Object



21
22
23
# File 'lib/rghost_barcode/rghost_barcode_base.rb', line 21

def add_single(entry)
  @params << entry
end

#add_with_unit(key, value) ⇒ Object

using the framework unit



26
27
28
29
30
31
# File 'lib/rghost_barcode/rghost_barcode_base.rb', line 26

def add_with_unit(key,value)
  v=if RGhost::Config::GS[:unit] == RGhost::Units::Cm
    (value.to_f/2.545)
  end
  add(key, v || value )
end

#inspectObject



33
34
35
# File 'lib/rghost_barcode/rghost_barcode_base.rb', line 33

def inspect
  "#{self.class} - #{map}"
end

#makeObject

prototype



39
# File 'lib/rghost_barcode/rghost_barcode_base.rb', line 39

def make() end

#mapObject



10
11
12
# File 'lib/rghost_barcode/rghost_barcode_base.rb', line 10

def map
  @params.join(" ")
end

#to_sObject



36
37
38
# File 'lib/rghost_barcode/rghost_barcode_base.rb', line 36

def to_s
  map
end