Class: Kut::Library::Pin
- Inherits:
-
Object
- Object
- Kut::Library::Pin
- Defined in:
- lib/kut/library/components.rb
Overview
Implementation of Pin component
Instance Attribute Summary collapse
-
#convert ⇒ Object
Returns the value of attribute convert.
-
#etype ⇒ Object
Returns the value of attribute etype.
-
#length ⇒ Object
Returns the value of attribute length.
-
#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.
-
#snom ⇒ Object
Returns the value of attribute snom.
-
#snum ⇒ Object
Returns the value of attribute snum.
-
#unit ⇒ Object
Returns the value of attribute unit.
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ Pin
constructor
Parametrs name, number, pos, length, orientation, snum, snom, unit, convert, etype Example creation: Pin.new(:name => ‘PL2303’, :orientation => ‘U’, :pos => [15, 24]).
- #to_s ⇒ Object
Constructor Details
#initialize(params = {}) ⇒ Pin
Parametrs name, number, pos, length, orientation, snum, snom, unit, convert, etype Example creation: Pin.new(:name => ‘PL2303’, :orientation => ‘U’, :pos => [15, 24])
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/kut/library/components.rb', line 39 def initialize(params = {}) #name, number, posx, posy, length, orientation, snum, snom, unit, convert, etype if Hash === params @name = params[:name] ? params[:name] : '~' @number = params[:number] ? params[:number] : '0' @pos = params[:pos] ? params[:pos] : [0, 0] @length = params[:length] ? params[:length] : 300 @orientation = params[:orientation] ? params[:orientation] : 'R' @snum = params[:snum] ? params[:snum] : 40 @snom = params[:snom] ? params[:snom] : 40 @unit = params[:unit] ? params[:unit] : 0 @convert = params[:convert] ? params[:convert] : 0 @etype = params[:etype] ? params[:etype] : 'P' end #TODO implement raise exception end |
Instance Attribute Details
#convert ⇒ Object
Returns the value of attribute convert.
35 36 37 |
# File 'lib/kut/library/components.rb', line 35 def convert @convert end |
#etype ⇒ Object
Returns the value of attribute etype.
35 36 37 |
# File 'lib/kut/library/components.rb', line 35 def etype @etype end |
#length ⇒ Object
Returns the value of attribute length.
34 35 36 |
# File 'lib/kut/library/components.rb', line 34 def length @length end |
#name ⇒ Object
Returns the value of attribute name.
34 35 36 |
# File 'lib/kut/library/components.rb', line 34 def name @name end |
#number ⇒ Object
Returns the value of attribute number.
34 35 36 |
# File 'lib/kut/library/components.rb', line 34 def number @number end |
#orientation ⇒ Object
Returns the value of attribute orientation.
35 36 37 |
# File 'lib/kut/library/components.rb', line 35 def orientation @orientation end |
#pos ⇒ Object
Returns the value of attribute pos.
34 35 36 |
# File 'lib/kut/library/components.rb', line 34 def pos @pos end |
#snom ⇒ Object
Returns the value of attribute snom.
35 36 37 |
# File 'lib/kut/library/components.rb', line 35 def snom @snom end |
#snum ⇒ Object
Returns the value of attribute snum.
35 36 37 |
# File 'lib/kut/library/components.rb', line 35 def snum @snum end |
#unit ⇒ Object
Returns the value of attribute unit.
35 36 37 |
# File 'lib/kut/library/components.rb', line 35 def unit @unit end |
Instance Method Details
#to_s ⇒ Object
55 56 57 |
# File 'lib/kut/library/components.rb', line 55 def to_s "X #{@name} #{@number} #{@pos[0]} #{@pos[1]} #{@length} #{@orientation} #{@snum} #{@snom} #{@unit} #{@convert} #{@etype}\n" end |