Class: Kut::Library::Field

Inherits:
Object
  • Object
show all
Defined in:
lib/kut/library/components.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ Field

Returns a new instance of Field.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/kut/library/components.rb', line 8

def initialize(params = {}) 
  #number, text, pos, dimension, orientation, visibility, hjustify, vjustify, italic, bold, name
  if Hash === params
    @number = params[:number] ? params[:number] : 0 
    @text = params[:text] ? params[:text] : 'TEXT'
    @pos = params[:pos] ? params[:pos] : [0, 0]
    @dimension = params[:dimension] ? params[:dimension] : 50
    @orientation = params[:orientation] ? params[:orientation] : 'H'
    @visibility = params[:visibility] ? params[:visibility] : 'V'
    @hjustify = params[:hjustify] ? params[:hjustify] : 'C'
    @vjustify = params[:vjustify] ? params[:vjustify] : 'C'
    @italic = params[:italic] ? params[:italic] : 'N'
    @bold = params[:bold] ? params[:bold] : 'N'
    @name = params[:name] ? params[:name] : nil
  end
  #TODO implement raise exception
end

Instance Attribute Details

#boldObject

Returns the value of attribute bold.



6
7
8
# File 'lib/kut/library/components.rb', line 6

def bold
  @bold
end

#dimensionObject

Returns the value of attribute dimension.



5
6
7
# File 'lib/kut/library/components.rb', line 5

def dimension
  @dimension
end

#hjustifyObject

Returns the value of attribute hjustify.



6
7
8
# File 'lib/kut/library/components.rb', line 6

def hjustify
  @hjustify
end

#italicObject

Returns the value of attribute italic.



6
7
8
# File 'lib/kut/library/components.rb', line 6

def italic
  @italic
end

#nameObject

Returns the value of attribute name.



6
7
8
# File 'lib/kut/library/components.rb', line 6

def name
  @name
end

#numberObject

Returns the value of attribute number.



5
6
7
# File 'lib/kut/library/components.rb', line 5

def number
  @number
end

#orientationObject

Returns the value of attribute orientation.



5
6
7
# File 'lib/kut/library/components.rb', line 5

def orientation
  @orientation
end

#posObject

Returns the value of attribute pos.



5
6
7
# File 'lib/kut/library/components.rb', line 5

def pos
  @pos
end

#textObject

Returns the value of attribute text.



5
6
7
# File 'lib/kut/library/components.rb', line 5

def text
  @text
end

#visibilityObject

Returns the value of attribute visibility.



6
7
8
# File 'lib/kut/library/components.rb', line 6

def visibility
  @visibility
end

#vjustifyObject

Returns the value of attribute vjustify.



6
7
8
# File 'lib/kut/library/components.rb', line 6

def vjustify
  @vjustify
end

Instance Method Details

#to_sObject



26
27
28
29
# File 'lib/kut/library/components.rb', line 26

def to_s
  __name = @name ? "\"#{@name}\"" : ''        
  "F#{@number} \"#{@text}\" #{@pos[0]} #{@pos[1]} #{@dimension} #{@orientation} #{@visibility} #{@hjustify} #{@vjustify}#{@italic}#{@bold} #{__name}\n"      
end