Class: Kut::Library::Field
- Inherits:
-
Object
- Object
- Kut::Library::Field
- Defined in:
- lib/kut/library/components.rb
Instance Attribute Summary collapse
-
#bold ⇒ Object
Returns the value of attribute bold.
-
#dimension ⇒ Object
Returns the value of attribute dimension.
-
#hjustify ⇒ Object
Returns the value of attribute hjustify.
-
#italic ⇒ Object
Returns the value of attribute italic.
-
#name ⇒ Object
Returns the value of attribute name.
-
#number ⇒ Object
Returns the value of attribute number.
-
#orientation ⇒ Object
Returns the value of attribute orientation.
-
#pos ⇒ Object
Returns the value of attribute pos.
-
#text ⇒ Object
Returns the value of attribute text.
-
#visibility ⇒ Object
Returns the value of attribute visibility.
-
#vjustify ⇒ Object
Returns the value of attribute vjustify.
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ Field
constructor
A new instance of Field.
- #to_s ⇒ Object
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
#bold ⇒ Object
Returns the value of attribute bold.
6 7 8 |
# File 'lib/kut/library/components.rb', line 6 def bold @bold end |
#dimension ⇒ Object
Returns the value of attribute dimension.
5 6 7 |
# File 'lib/kut/library/components.rb', line 5 def dimension @dimension end |
#hjustify ⇒ Object
Returns the value of attribute hjustify.
6 7 8 |
# File 'lib/kut/library/components.rb', line 6 def hjustify @hjustify end |
#italic ⇒ Object
Returns the value of attribute italic.
6 7 8 |
# File 'lib/kut/library/components.rb', line 6 def italic @italic end |
#name ⇒ Object
Returns the value of attribute name.
6 7 8 |
# File 'lib/kut/library/components.rb', line 6 def name @name end |
#number ⇒ Object
Returns the value of attribute number.
5 6 7 |
# File 'lib/kut/library/components.rb', line 5 def number @number end |
#orientation ⇒ Object
Returns the value of attribute orientation.
5 6 7 |
# File 'lib/kut/library/components.rb', line 5 def orientation @orientation end |
#pos ⇒ Object
Returns the value of attribute pos.
5 6 7 |
# File 'lib/kut/library/components.rb', line 5 def pos @pos end |
#text ⇒ Object
Returns the value of attribute text.
5 6 7 |
# File 'lib/kut/library/components.rb', line 5 def text @text end |
#visibility ⇒ Object
Returns the value of attribute visibility.
6 7 8 |
# File 'lib/kut/library/components.rb', line 6 def visibility @visibility end |
#vjustify ⇒ Object
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_s ⇒ Object
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 |