ShapeDoc 0.3.4 → 0.3.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/shapedoc.rb +3 -2
- metadata +16 -3
- data/lib/ShapeStruct.rb +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ebdf04a41fa2c1ed657bdb9382be451e1f31bb77
|
4
|
+
data.tar.gz: 3093fa681a380302551cd76bd4ad9fc1cf15d795
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bb044248762ffd041b736cd65f7bb0c724e967f8eb9375b84caae085c0bdbcf3322ee7a2bc900d2e5381b82fcb507bfc85f3b853bf1e5681347215fb46afd0eb
|
7
|
+
data.tar.gz: 60bc03c31733e8bfbb5239bced25a64762db4bd7763d04383acd687c3aa6974c124218f7eb72ccc099ab82d52f01dcf40cc78f1a6c77da250116d5c7ba42b818
|
data/lib/shapedoc.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
require "Shapestruct" rescue nil
|
2
2
|
class Polygon
|
3
3
|
attr_accessor :sides
|
4
4
|
def _sides; @sides.length; end
|
@@ -27,6 +27,7 @@ class Rectangle < Quadrilateral
|
|
27
27
|
def perimeter; @width*2+@length*2; end
|
28
28
|
def area; @length*@width; end
|
29
29
|
def diagram; "\u25AD"; end
|
30
|
+
def right_angles; 4; end
|
30
31
|
end
|
31
32
|
class Square < Rectangle
|
32
33
|
attr_reader :side
|
@@ -94,7 +95,7 @@ class Pentagon < Polygon # Regular Pentagon
|
|
94
95
|
attr_reader :side
|
95
96
|
def initialize(side); @side = side; end
|
96
97
|
def _sides; 5; end
|
97
|
-
def diagram; "\u2b20"; end
|
98
|
+
def diagram; "\u2b20"; end # Displays a pentagon
|
98
99
|
def area; (5* @side ** 2 * tan(54))/4; end
|
99
100
|
end
|
100
101
|
__END__
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ShapeDoc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zachary Perlmutter
|
@@ -9,7 +9,21 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
date: 2014-06-18 00:00:00.000000000 Z
|
12
|
-
dependencies:
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: Shapestruct
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.1.0
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.1.0
|
13
27
|
description: |
|
14
28
|
Allows you to use shapes in your application. Shapes include cirles, squares, rectangles, and more.
|
15
29
|
email: zrp200@gmail.com
|
@@ -17,7 +31,6 @@ executables: []
|
|
17
31
|
extensions: []
|
18
32
|
extra_rdoc_files: []
|
19
33
|
files:
|
20
|
-
- lib/ShapeStruct.rb
|
21
34
|
- lib/shapedoc.rb
|
22
35
|
homepage:
|
23
36
|
licenses: []
|
data/lib/ShapeStruct.rb
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
def Polygon(*sides)
|
2
|
-
s, s.sides = Polygon.new(sides), Array.new
|
3
|
-
for side in sides; s.sides << side; end
|
4
|
-
return s
|
5
|
-
end
|
6
|
-
def Quad(side1=rand, side2=rand, side3=rand, side4=rand); Quadrilateral.new(side1, side2, side3, side4); end
|
7
|
-
def Rect( l = rand, w = rand ); Rectangle.new(l,w); end
|
8
|
-
def Square(s = rand); Square.new(s); end
|
9
|
-
def Rhombus(arg = Hash.new); Rhombus.new arg; end
|
10
|
-
def Tri(s1=rand, s2=rand, s3=rand, arg = Hash.new); Triangle.new s1, s2, s3, arg; end
|
11
|
-
def Circle(r = rand); Circle.new r; end
|
12
|
-
def Parallel(args = Hash.new(0)); Parallelogram.new(args); end
|
13
|
-
def Pentagon(arg = rand); Pentagon.new arg; end
|