Class: Kut::Library::Text

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ Text

:orientation, :pos, :dimension, :unit, :convert, :text



64
65
66
67
68
69
70
71
72
73
74
# File 'lib/kut/library/components.rb', line 64

def initialize(params = {}) #:orientation, :pos, :dimension, :unit, :convert, :text
  if Hash === params
    @orientation = params[:orientation] ? params[:orientation] : 0
    @pos = params[:pos] ? params[:pos] : [0, 0]
    @dimension = params[:dimension] ? params[:dimension] : 40
    @unit = params[:unit] ? params[:unit] : 0
    @convert = params[:convert] ? params[:convert] : 0
    @text = params[:text] ? params[:text] : ''
  end
  #TODO implement raise exception
end

Instance Attribute Details

#convertObject

Returns the value of attribute convert.



61
62
63
# File 'lib/kut/library/components.rb', line 61

def convert
  @convert
end

#dimensionObject

Returns the value of attribute dimension.



61
62
63
# File 'lib/kut/library/components.rb', line 61

def dimension
  @dimension
end

#orientationObject

Returns the value of attribute orientation.



61
62
63
# File 'lib/kut/library/components.rb', line 61

def orientation
  @orientation
end

#posObject

Returns the value of attribute pos.



61
62
63
# File 'lib/kut/library/components.rb', line 61

def pos
  @pos
end

#textObject

Returns the value of attribute text.



61
62
63
# File 'lib/kut/library/components.rb', line 61

def text
  @text
end

#unitObject

Returns the value of attribute unit.



61
62
63
# File 'lib/kut/library/components.rb', line 61

def unit
  @unit
end

Instance Method Details

#to_sObject



76
77
78
# File 'lib/kut/library/components.rb', line 76

def to_s
  "T #{@orientation} #{@pos[0]} #{@pos[1]} #{@dimension} 0 #{@unit} #{@convert} #{@text}\n"
end