Class: Kut::Library::Polygon
- Inherits:
-
Object
- Object
- Kut::Library::Polygon
- Defined in:
- lib/kut/library/components.rb
Instance Attribute Summary collapse
-
#cc ⇒ Object
Returns the value of attribute cc.
-
#convert ⇒ Object
Returns the value of attribute convert.
-
#ltrait ⇒ Object
Returns the value of attribute ltrait.
-
#parts ⇒ Object
Returns the value of attribute parts.
-
#points ⇒ Object
Returns the value of attribute points.
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ Polygon
constructor
:parts, :convert, :ltrait, :points, :cc.
- #to_s ⇒ Object
Constructor Details
#initialize(params = {}) ⇒ Polygon
:parts, :convert, :ltrait, :points, :cc
85 86 87 88 89 90 91 92 93 94 |
# File 'lib/kut/library/components.rb', line 85 def initialize(params = {}) #:parts, :convert, :ltrait, :points, :cc if Hash === params @parts = params[:parts] ? params[:parts] : 0 @points = params[:points] ? params[:points] : [] @convert = params[:convert] ? params[:convert] : 0 @ltrait = params[:ltrait] ? params[:ltrait] : 0 @cc = params[:cc] ? params[:cc] : 'N' end #TODO implement raise exception end |
Instance Attribute Details
#cc ⇒ Object
Returns the value of attribute cc.
83 84 85 |
# File 'lib/kut/library/components.rb', line 83 def cc @cc end |
#convert ⇒ Object
Returns the value of attribute convert.
82 83 84 |
# File 'lib/kut/library/components.rb', line 82 def convert @convert end |
#ltrait ⇒ Object
Returns the value of attribute ltrait.
82 83 84 |
# File 'lib/kut/library/components.rb', line 82 def ltrait @ltrait end |
#parts ⇒ Object
Returns the value of attribute parts.
82 83 84 |
# File 'lib/kut/library/components.rb', line 82 def parts @parts end |
#points ⇒ Object
Returns the value of attribute points.
83 84 85 |
# File 'lib/kut/library/components.rb', line 83 def points @points end |
Instance Method Details
#to_s ⇒ Object
96 97 98 99 100 101 102 |
# File 'lib/kut/library/components.rb', line 96 def to_s result = "P #{@points.length} #{@parts} #{@convert} #{@ltrait}" @points.each { |point| result += " #{point[0]} #{point[1]}" } result += " #{@cc}\n" end |