ruby-svg 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6ffb6a71e63ff7edc59c3c980647026b1b473e7e331f476912d43b2fe6b5f9db
4
- data.tar.gz: e2426c43ad0aa901a46c2328d1502d0e9d38e860cea4f5919d1a064cedbbbc6e
3
+ metadata.gz: afec90bfb3fabc8b5c15af038b28f47cc74f28e51b7c2a29bb48b690a028d518
4
+ data.tar.gz: 3f2eecec573f9eb316825452faef485a7cccc964ad7e310ff3d5aaaa774f74ab
5
5
  SHA512:
6
- metadata.gz: 7706fcd0bce7e321a4a04214336b919b838f0f022bb836aa3f998f986ee9a2c80e097a44ab4a17f1c9b1d58e6fd4865a396a651b419876073febd571c04309eb
7
- data.tar.gz: 6ddf24dcc0bb2c30936dd273c17fcb7accfb464e62a65fe13cc1e7dae3c452ec3fde319df7b37fee2be501999708dd7da9f36f983f8baece5c0ab4a8d858a148
6
+ metadata.gz: b94cd8bbb8468d71b776975199e7cef82e16420690b21b0b36b326eea410490653dcb419abd0a4a25f82637bcbd3a43a9b80ed324050509ab982524f83e0a1f4
7
+ data.tar.gz: 111c521dae4630c4d44a78396070b8b252c1faab71c851fa1e20089f3103a03447673abfeccaca8b787c267f4c3ad2d50f40e54bf505a70f21eabad0df8c2ede
data/Gemfile.lock ADDED
@@ -0,0 +1,42 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ ruby-svg (0.1.1)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ ast (2.4.2)
10
+ json (2.6.3)
11
+ parallel (1.22.1)
12
+ parser (3.2.2.0)
13
+ ast (~> 2.4.1)
14
+ rainbow (3.1.1)
15
+ rake (13.0.6)
16
+ regexp_parser (2.7.0)
17
+ rexml (3.2.5)
18
+ rubocop (1.43.0)
19
+ json (~> 2.3)
20
+ parallel (~> 1.10)
21
+ parser (>= 3.2.0.0)
22
+ rainbow (>= 2.2.2, < 4.0)
23
+ regexp_parser (>= 1.8, < 3.0)
24
+ rexml (>= 3.2.5, < 4.0)
25
+ rubocop-ast (>= 1.24.1, < 2.0)
26
+ ruby-progressbar (~> 1.7)
27
+ unicode-display_width (>= 2.4.0, < 3.0)
28
+ rubocop-ast (1.28.0)
29
+ parser (>= 3.2.1.0)
30
+ ruby-progressbar (1.11.0)
31
+ unicode-display_width (2.4.2)
32
+
33
+ PLATFORMS
34
+ arm64-darwin-21
35
+
36
+ DEPENDENCIES
37
+ rake (~> 13.0)
38
+ rubocop (~> 1.21)
39
+ ruby-svg!
40
+
41
+ BUNDLED WITH
42
+ 2.4.6
@@ -0,0 +1,7 @@
1
+ SVG.register(:point, :x, :y) do |svg, x, y, **attrs|
2
+ attrs[:fill] ||= svg.stroke || :black
3
+ attrs[:stroke] ||= svg.fill || :none
4
+ r ||= attrs.delete(:r) || 1
5
+
6
+ svg.circle(x, y, r, **attrs)
7
+ end
@@ -0,0 +1,58 @@
1
+ require "ruby-svg"
2
+
3
+ # You can include helpers externally!
4
+ require_relative "../helpers/point"
5
+
6
+ # Or build them inline
7
+ SVG.register(:bezier_helper, :p1, :b1, :b2, :p2) do |svg, p1, b1, b2, p2, **attrs|
8
+ path_cmd = [:M, p1.join(","), :C, *[b1, b2, p2].map { |c| c.join(",") }]
9
+ # puts "\e[36m#{path.join(" ")}\e[0m"
10
+ svg.path(path_cmd.join(" "), **attrs)
11
+
12
+ svg.line(*p1, *b1, stroke: :cyan, opacity: 0.6)
13
+ svg.point(*b1, fill: :cyan, opacity: 0.4)
14
+ svg.point(*p1, fill: :blue, opacity: 0.4)
15
+
16
+ svg.line(*b2, *p2, stroke: :lime, opacity: 0.6)
17
+ svg.point(*b2, fill: :lime, opacity: 0.4)
18
+ svg.point(*p2, fill: :green, opacity: 0.4)
19
+ end
20
+
21
+ # And use them right away!
22
+ SVG.write(:svg, filename: :slime) do |svg|
23
+ svg.width = 100
24
+ svg.height = 100
25
+
26
+ svg.path(
27
+ "M 5 65
28
+ C 0,110 100,110 95,65
29
+ C 90,40 60,45 55,15
30
+ C 53,5 47,5 45,15
31
+ C 40,45 10,40 5,65
32
+ Z",
33
+ id: :slimeBody,
34
+ stroke: "#0160FF",
35
+ fill: "#0160FFAA",
36
+ )
37
+ # The bezier helpers draw the bezier lines/points so you can visually see the curve
38
+ # svg.bezier_helper([55,15], [53,5], [47,5], [45,15])
39
+ svg.bezier_helper([95,65], [90,40], [60,45], [55,15])
40
+ # svg.bezier_helper([45,15], [40,45], [10,40], [5,65])
41
+
42
+ svg.path(
43
+ "M 25,75 C 30,90 70,90 75,75",
44
+ id: :smile,
45
+ stroke: :red,
46
+ stroke_width: 7,
47
+ stroke_linecap: :round,
48
+ )
49
+ # svg.bezier_helper([25,75], [30,90], [70,90], [75,75], stroke: :red, stroke_width: 7, stroke_linecap: :round)
50
+
51
+ # eyes
52
+ eye = ->(x) {
53
+ svg.circle(x, 60, 8, stroke: :transparent, fill: :white)
54
+ svg.circle(x, 60, 2.5, stroke: :transparent, fill: :black)
55
+ }
56
+ eye[37]
57
+ eye[63]
58
+ end
@@ -0,0 +1,20 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" fill="transparent" stroke="black">
2
+ <path id="slimeBody" stroke="#0160FF" fill="#0160FFAA" d="M 5 65
3
+ C 0,110 100,110 95,65
4
+ C 90,40 60,45 55,15
5
+ C 53,5 47,5 45,15
6
+ C 40,45 10,40 5,65
7
+ Z" />
8
+ <path d="M 95,65 C 90,40 60,45 55,15" />
9
+ <line stroke="cyan" opacity="0.6" x1="95" y1="65" x2="90" y2="40" />
10
+ <circle fill="cyan" opacity="0.4" stroke="transparent" cx="90" cy="40" r="1" />
11
+ <circle fill="blue" opacity="0.4" stroke="transparent" cx="95" cy="65" r="1" />
12
+ <line stroke="lime" opacity="0.6" x1="60" y1="45" x2="55" y2="15" />
13
+ <circle fill="lime" opacity="0.4" stroke="transparent" cx="60" cy="45" r="1" />
14
+ <circle fill="green" opacity="0.4" stroke="transparent" cx="55" cy="15" r="1" />
15
+ <path id="smile" stroke="red" stroke-width="7" stroke-linecap="round" d="M 25,75 C 30,90 70,90 75,75" />
16
+ <circle stroke="transparent" fill="white" cx="37" cy="60" r="8" />
17
+ <circle stroke="transparent" fill="black" cx="37" cy="60" r="2.5" />
18
+ <circle stroke="transparent" fill="white" cx="63" cy="60" r="8" />
19
+ <circle stroke="transparent" fill="black" cx="63" cy="60" r="2.5" />
20
+ </svg>
@@ -0,0 +1,77 @@
1
+ require "ruby-svg"
2
+ require "date"
3
+
4
+ SVG.register(:spiral) do |svg, attrs|
5
+ center_x = svg.width/2
6
+ center_y = svg.height/2
7
+ max_rev = attrs.delete(:max_rev) || 10
8
+ progress = attrs.delete(:progress) || 1
9
+ outer_radius = attrs.delete(:size) || [center_x, center_y].min
10
+
11
+ # line_width = (max_radius/(max_rev+1).to_f)-1
12
+ # padding = max_line_width
13
+ # outer_radius = max_radius - padding
14
+ # line_width = (outer_radius/max_rev.to_f)-1
15
+
16
+ path = ["M#{center_x},#{center_y-outer_radius}"] # Starting at top-center
17
+ (0..max_rev * 360).step(1).each do |angle|
18
+ rotation = 90
19
+ radians = (angle - rotation) * (Math::PI / 180)
20
+ radius = outer_radius * (1 - (angle.to_f / (max_rev*360)))
21
+
22
+ x = center_x + radius * Math.cos(radians)
23
+ y = center_y + radius * Math.sin(radians)
24
+ path << "L#{x},#{y} "
25
+
26
+ break if angle.to_f > (progress*360)
27
+ end
28
+ path.join(" ")
29
+
30
+ svg.path(path.join(" "), **attrs)
31
+ end
32
+
33
+ SVG.write(:svg, filename: "spiral.svg") do |svg|
34
+ svg.width = 400
35
+ svg.height = 400
36
+
37
+ goal = 1000
38
+ current = goal-740
39
+ done_today = 30
40
+ needed_today = 41
41
+
42
+ now = Time.now
43
+ morning = Time.new(now.year, now.month, now.day, 9).to_i
44
+ tonight = Time.new(now.year, now.month, now.day, 18).to_i
45
+ today_progress = ((now.to_i - morning) / (tonight - morning).to_f).clamp(0, 1)
46
+ today_goal_progress = done_today/needed_today.to_f
47
+
48
+ today = Date.today
49
+ days_in_month = Date.new(today.year, today.month, -1).day
50
+ month_progress = today.day/days_in_month.to_f
51
+ month_goal_progress = current/goal.to_f
52
+
53
+ center_x = svg.width/2
54
+ center_y = svg.height/2
55
+ max_radius = [center_x, center_y].min
56
+
57
+ blue = "#0160FF"
58
+ orange = "#FFA001"
59
+
60
+ rings = 10
61
+ full_line_width = ([center_x, center_y].min/(rings+1).to_f)-1 # 18.18
62
+ big_circle = max_radius - full_line_width
63
+ small_circle = max_radius - ((full_line_width+1)*2)
64
+
65
+ svg.spiral(progress: today_goal_progress, max_rev: rings, size: big_circle, stroke_width: full_line_width, stroke: blue)
66
+ svg.spiral(progress: today_progress, max_rev: rings, size: big_circle, stroke_width: 5, stroke: orange)
67
+
68
+ svg.spiral(progress: month_goal_progress, max_rev: rings, size: small_circle, stroke_width: full_line_width, stroke: "rgba(150, 10, 50, 0.5)")
69
+ svg.spiral(progress: month_progress, max_rev: rings, size: small_circle, stroke_width: 5, stroke: "rgba(240, 100, 50, 0.5)")
70
+
71
+ # svg.spiral(progress: rand*10, max_rev: rings)
72
+ svg.text(done_today, "50%", "50%", **{
73
+ stroke: blue, fill: blue,
74
+ text_anchor: :middle, dominant_baseline: :middle,
75
+ font_size: 100, font_family: :Arial
76
+ })
77
+ end
@@ -0,0 +1,9 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 400" fill="transparent" stroke="black">
2
+ <path stroke-width="17.181818181818183" stroke="#0160FF" d="M200,17.181818181818187 L200.0,17.181818181818187 L203.18973093065688,17.260437370220956 L206.3767179432245,17.39468986411174 L209.55999106041423,17.584503842776826 L212.73858197583766,17.829790579779456 L215.91152434855096,18.130444479401802 L219.07785409683626,18.48634311821624 L222.2366096911311,18.89734729177121 L225.38683244601629,19.363301066374788 L228.52756681117407,19.884031835956364 L231.65786066122797,20.459350383987243 L234.7767655843765,21.08905095043781 L237.88333716973327,21.772911303748714 L240.97663529328617,22.510692817790186 L244.05572440238993,23.302140553784596 L247.11967379870433,24.1469833471634 L250.1675579194944,25.04493389932975 L253.1984566172063,25.995688874295894 L256.21145543723446,26.998929000163088 L259.20564589379745,28.054319175410654 L262.1801257438372,29.16150857995828 L265.1339992588613,30.320130790966203 L268.0663774946447,31.529803903334084 L270.9763785587104,32.79013065485981 L273.8631278755089,34.10069855601742 L276.725758449216,35.46108002431154 L279.5634111240705,36.870832523165404 L282.37523484217337,38.32949870529666 L285.1603868986714,39.8366065605357 L287.9180331942484,41.39166956803771 L290.6473484848485,42.994186852840755 L293.34751662855706,44.64364334671865 L296.01773082956504,46.339509953277684 L298.6571938791436,48.081243717244206 L301.26511839355834,49.86828799788884 L303.8407270488501,51.70007264653273 L306.3832528124147,53.57601418807829 L308.89193917131047,55.495516006507785 L311.36604035722723,57.457968534290245 L313.80482156804936,59.462749445636945 L316.2075591859466,61.50922385354386 L318.5735409919288,63.5967445105598 L320.9020663768007,65.72465201321538 L323.19244654845403,67.8922750100497 L325.4440047354359,70.09893041316838 L327.6560763867337,72.34392361326636 L329.8280093677165,74.62654869804857 L331.959164152177,76.94608867397888 L334.04891401041573,79.30181569128833 L336.09664519331335,81.6929912721722 L338.1017571123369,84.11886654210383 L340.0636625154267,86.57868246419343 L341.98178765871364,89.07167007651816 L343.8555724740154,91.59705073234964 L345.6844707320636,94.15403634320354 L347.46795020141417,96.74182962463573 L349.20549280299554,99.35962434470814 L350.89659476024775,102.00660557504742 L352.54076674481234,104.68194994441724 L354.1375340177275,107.38482589472665 L355.6864365660907,110.11439393939396 L357.1870292351483,112.86980692398629 L358.638881855774,115.65021028905393 L360.04157936730076,118.45474233507775 L361.39472193567076,121.2825344894479 L362.6979250668696,124.1327115753906 L363.95081971561365,127.00439208276049 L365.1530523892592,129.89668844061396 L366.30428524690444,132.80870729147986 L367.40419619365696,135.73954976724244 L368.45247897004117,138.6883117665516 L369.4488432365194,141.65408423367464 L370.3930146531057,144.63595343870375 L371.2847349540492,147.63300125903248 L372.12376201756786,150.64430546201527 L372.90986993061335,153.6689399887217 L373.64284904865116,156.70597523869992 L374.3225060504391,159.7544783556601 L374.9486639877918,162.81351351399096 L375.5211623303172,165.88214220602129 L376.03985700511555,168.95942352993805 L376.50462043143125,172.04441447827304 L376.91534155024874,175.13617022686935 L377.27192584882846,178.23374442423935 L377.5742953801758,181.3361894812253 L377.82238877744163,184.44255686087436 L378.01616126325223,187.55189736843894 L378.1555846539686,190.66326144141365 L378.240647358877,193.77569943952076 L378.2713543743135,196.88826193455506 L378.2477272727273,200.0 L378.16980418668925,203.10996550032647 L378.0376397878532,206.21721137988644 L377.85130526087903,209.32079195131294 L377.61088827232845,212.41976318333894 L377.31649293454706,215.51318298794746 L376.9682397645438,218.60011150676524 L376.5662656378863,221.67961139661347 L376.1107237376268,224.75074811412833 L375.6017834982781,227.81259019936516 L375.0396305448593,230.86420955830022 L374.4244666270321,233.90468174414414 L373.756509548352,236.93308623738207 L373.03599309065726,239.94850672445548 L372.2631669336222,242.95003137500146 L371.43829656950174,245.9367531175653 L370.56166321309763,248.90776991370356 L369.63356370697306,251.86218503039396 L368.65431042195155,254.79910731067076 L367.6242311529298,257.71765144240345 L366.54366901004073,260.61693822513735 L365.41298230520226,263.4960948349168 L364.23254443408905,266.3542550870097 L363.0027437535655,269.19055969645603 L361.7239834546206,272.0041565363602 L360.39668143084594,274.7942008938511 L359.02127014249913,277.5598557236322 L357.59819647619696,280.30029189904553 L356.1279216002841,283.014688460575 L354.6109208159229,285.7022328617134 L353.04768340395356,288.3621212121212 L351.4387124675724,290.99355851800226 L349.7845247708801,293.59575891962646 L348.0856505733507,296.1679459259272 L346.3426334602743,298.70935264610455 L344.5560301692283,301.21922201816386 L342.7264104126308,303.69680703432346 L340.85435669643516,306.14137096322236 L338.9404641350209,308.55218756886387 L336.9853402623404,310.9285413262284 L334.98960483938276,313.26972763349283 L332.95388965801294,315.57505302079267 L330.87883834125046,317.8438353554651 L328.76510614004997,320.07540404371383 L326.6133597266475,322.26910022863353 L324.42427698453787,324.42427698453787 L322.198546795149,326.54029950753227 L319.93686882128094,328.61654530227656 L317.6399532873761,330.6524043648815 L315.3085207566916,332.64727936188604 L312.94330190544247,334.60058580526356 L310.5450372939856,336.5117522234041 L308.1144771351185,338.3802203280248 L305.65238105956223,340.20544517695834 L303.1595178787052,341.98689533277263 L300.636665344678,343.72405301717515 L298.08460990783806,345.4164142611587 L295.5041464717362,347.0634890508427 L292.8960781456442,348.66480146897015 L290.26121599471855,350.21988983201845 L287.6003787878788,351.728306822885 L284.91439274347874,353.18961961910895 L282.20409127284967,354.6034100165938 L279.47031472179447,355.9692745487944 L276.71391011011383,357.2868246013352 L273.93573086924454,358.55568652202703 L271.1366365780908,359.7755017262517 L268.3174926971316,360.9459267976846 L265.47917030088513,362.0666335843276 L262.622545808813,363.13730928982545 L259.7485007147486,364.1576565600401 L256.8579213149314,365.12739356485974 L253.95169843473258,366.0462540752203 L251.0307271541552,366.9139875353182 L248.09590653219388,367.73035912999524 L245.14813933013932,368.4951498472786 L242.1883317339116,369.2081565360579 L239.2173930755092,369.86919195888663 L236.2362355536579,370.4780848398925 L233.2457739537464,371.0346799077871 L230.24692536713422,371.53883793396204 L227.24060890991808,371.9904357656657 L224.2277454412427,372.38936635425034 L221.20925728124305,372.735538778486 L218.1860679287037,373.0288782629358 L215.15910177852214,373.2693261913905 L212.12928383906234,373.45684011536014 L209.0975394494851,373.59139375762436 L206.06479399714124,373.67297701084203 L203.03197263511453,373.7015959312237 L200.0,373.6772727272727 L196.96979993000394,373.6000457435995 L193.9422951834516,373.4699694398182 L190.91840715778835,373.2871143645348 L187.89905560915977,373.05156712443636 L184.885158372656,372.76343034849594 L181.87763108330574,372.4228226473038 L178.87738689790416,372.0298785675438 L175.88533621775963,371.5847485416284 L172.90238641244372,371.08759883251264 L169.9294415446275,370.5386114737057 L166.9674020960882,369.93798420450196 L164.0171646949691,369.28593040045274 L161.07962184437523,368.5826789991048 L158.155661652387,367.8284744210289 L155.2461675635737,367.023576486167 L152.35201809208735,366.168260325525 L149.4740865564184,365.262816288242 L146.6132408158929,364.3075498440662 L143.7703430089905,363.3027814812702 L140.94624929356243,362.24884660003966 L138.14180958902776,361.14609540137076 L135.3578673206253,359.99489277151224 L132.59525916579838,358.79561816199083 L129.8548148027885,357.54866546525864 L127.13735666151378,356.25444288600346 L124.44369967680602,354.91337280816356 L121.77465104408223,353.5258916576906 L119.13100997752144,352.0924497611038 L116.51356747082157,350.61351119988353 L113.92310606060609,349.0895536607479 L111.36039959255254,347.5210682818634 L108.82621299031216,345.9085594950379 L106.32130202728916,344.25254486394556 L103.84641310134928,342.5535549184376 L101.40228301252239,340.81213298498926 L98.98963874376787,339.02883501333986 L96.60919724486574,337.2042293993781 L94.26166521949956,335.33889680433197 L91.94773891559258,333.4334299703178 L89.66810391896082,331.4884335323095 L87.42343495034356,329.5045238265857 L85.2143956658705,327.48232869571626 L83.04163846102638,325.42248729014966 L80.9058042781688,323.3256498664633 L78.80752241765794,321.19247758234206 L76.74741035265183,319.02364228834665 L74.72607354762374,316.8198263165408 L72.74410528065272,314.5817222660405 L70.80208646954117,312.3100327855555 L68.90058550180981,310.0054703529888 L67.04015806861861,307.66875705216466 L65.22134700266412,305.30062434675506 L63.44468212009869,302.9018128514741 L61.710680066518364,300.47307210061393 L60.01984416706381,298.01516031399177 L58.37266428067812,295.52884416038427 L56.769616658562455,293.01489851851983 L55.211163806872094,290.4741062357056 L53.6977543536905,287.90725788416376 L52.229822920320686,285.3151515151515 L50.80778999693044,282.69859241094383 L49.432061822586434,280.05839283475325 L48.10303026971201,277.3953717786667 L46.82107273300028,274.7103547096756 L45.586552022815425,272.0041733138796 L44.399816263110324,269.2776652389421 L43.26119879389012,266.53167383487727 L42.17101807824926,263.76704789325015 L41.12957761400608,260.98464138486844 L40.13716584996095,258.1853131960488 L39.19405610679982,255.36992686353742 L38.30050650266503,252.5393503081689 L37.45675988341287,249.69445556734283 L36.663043757577384,246.83611852640303 L35.919570236056245,243.96521864900032 L35.22653597653536,241.08263870652314 L34.584122132665925,238.1892645066785 L33.99249430800674,235.2859846213067 L33.451802514743065,232.37369011351404 L32.962181137191465,229.4532742642065 L32.523748900099804,226.52563229810923 L32.136608841748085,223.59166110935473 L31.800848291856568,220.65225898672543 L31.5165388543042,217.7083253386327 " />
3
+ <path stroke-width="5" stroke="#FFA001" d="M200,17.181818181818187 L200.0,17.181818181818187 L203.18973093065688,17.260437370220956 " />
4
+ <path stroke-width="17.181818181818183" stroke="rgba(150, 10, 50, 0.5)" d="M200,36.363636363636374 L200.0,36.363636363636374 L202.85505503489927,36.43400659691582 L205.70765405161814,36.55417292660425 L208.55692884572133,36.724071067627165 L211.40201270835792,36.943621602985104 L214.24204068990142,37.21273001637158 L217.07614986290665,37.531286729383 L219.9034795843043,37.89916714330593 L222.7231717567525,38.31623168546727 L225.53437108906678,38.782325860130015 L228.3362253556491,39.29728030391695 L231.12788565483726,39.86091084574247 L233.9085066660964,40.473018571232075 L236.6772469059747,41.13338989160735 L239.43326898274583,41.84179661701259 L242.17573984966077,42.59799603425864 L244.90383105673294,43.401730988957496 L247.61671900098025,44.252729972020205 L250.31358517504827,45.15070721048909 L252.99361641413992,46.09536276267488 L255.65600514117702,47.086382617565846 L258.29994961011954,48.12343879847796 L260.92465414736967,49.20618947091069 L263.52932939118784,50.33427905457367 L266.11319252904826,51.50733833954817 L268.67546753286365,52.72498460654438 L271.2153853920074,53.98682175121718 L273.7321843440637,55.29244041249825 L276.2251101032365,56.64141810490517 L278.69341608634863,58.033319354782634 L281.1363636363636,59.46769584043429 L283.5532222433629,60.94408653609824 L285.9432697629125,62.46201785972147 L288.3057926317546,64.02100382448512 L290.6400860807583,65.62054619403281 L292.9454543450672,67.26013464135201 L295.22121087138066,68.93924691125852 L297.4666785223067,70.65734898643163 L299.681189777727,72.41389525694801 L301.8640869331123,74.20832869326031 L304.0147222947309,76.04008102256537 L306.1324583716916,77.90857290850704 L308.21666806476446,79.81321413415597 L310.26673485192305,81.75340378820957 L312.2820529705543,83.7285304543526 L314.26202759628075,85.73797240371925 L316.2060750183439,87.78109779039654 L318.11362281149604,89.85726484990651 L319.9841100043502,91.96582210060618 L321.8169872441392,94.1061085479413 L323.6117169578351,96.27745389149025 L325.36777350958135,98.47917873473305 L327.08464335439317,100.71059479748021 L328.76182518807946,102.97100513089477 L330.3988300933438,105.25970433504048 L331.99518168202167,107.57597877888827 L333.5504162334122,109.91910682271241 L335.06408282866533,112.28835904280723 L336.53574348118457,114.68299845845401 L337.9649732630081,117.10228076106812 L339.35136042713236,119.54545454545458 L340.6945065257419,122.0117615431006 L341.99402652431286,124.50043685743266 L343.24954891155716,127.01070920096467 L344.4607158051752,129.54180113426463 L345.627183053389,132.0929293066649 L346.7486203322251,134.66330469864192 L347.82471123852145,137.2521328657907 L348.8551533786315,139.85861418431813 L349.8396584528009,142.4819440979793 L350.7779523351935,145.12131336638134 L351.669775149545,147.775908314577 L352.5148813404228,150.44491108387209 L353.3130397400739,153.1274998837685 L354.06403363084144,155.82284924496642 L354.7676608031348,158.53013027334612 L355.4237336089369,161.24851090485322 L356.0320790108356,163.97715616120743 L356.59253862656647,166.71522840635689 L357.10496876905563,169.46188760359937 L357.5692404819532,172.21629157329116 L357.9852395706495,174.97759625106488 L358.3528666287657,177.7449559464768 L358.6720370601149,180.5175236020044 L358.9426810961295,183.29445105231503 L359.16474380874934,186.07488928372643 L359.3381851187737,188.85798869377925 L359.4629797996735,191.64289935084264 L359.5391174768665,194.4287712536735 L359.5666026224586,197.21475459084988 L359.5454545454545,200.0 L359.4757073774444,202.78365882674672 L359.3574100537721,205.5648833832897 L359.190626290195,208.34282720654562 L358.97543455504285,211.11664531576832 " />
5
+ <path stroke-width="5" stroke="rgba(240, 100, 50, 0.5)" d="M200,36.363636363636374 L200.0,36.363636363636374 L202.85505503489927,36.43400659691582 L205.70765405161814,36.55417292660425 L208.55692884572133,36.724071067627165 L211.40201270835792,36.943621602985104 L214.24204068990142,37.21273001637158 L217.07614986290665,37.531286729383 L219.9034795843043,37.89916714330593 L222.7231717567525,38.31623168546727 L225.53437108906678,38.782325860130015 L228.3362253556491,39.29728030391695 L231.12788565483726,39.86091084574247 L233.9085066660964,40.473018571232075 L236.6772469059747,41.13338989160735 L239.43326898274583,41.84179661701259 L242.17573984966077,42.59799603425864 L244.90383105673294,43.401730988957496 L247.61671900098025,44.252729972020205 L250.31358517504827,45.15070721048909 L252.99361641413992,46.09536276267488 L255.65600514117702,47.086382617565846 L258.29994961011954,48.12343879847796 L260.92465414736967,49.20618947091069 L263.52932939118784,50.33427905457367 L266.11319252904826,51.50733833954817 L268.67546753286365,52.72498460654438 L271.2153853920074,53.98682175121718 L273.7321843440637,55.29244041249825 L276.2251101032365,56.64141810490517 L278.69341608634863,58.033319354782634 L281.1363636363636,59.46769584043429 L283.5532222433629,60.94408653609824 L285.9432697629125,62.46201785972147 L288.3057926317546,64.02100382448512 L290.6400860807583,65.62054619403281 L292.9454543450672,67.26013464135201 L295.22121087138066,68.93924691125852 L297.4666785223067,70.65734898643163 L299.681189777727,72.41389525694801 L301.8640869331123,74.20832869326031 L304.0147222947309,76.04008102256537 L306.1324583716916,77.90857290850704 L308.21666806476446,79.81321413415597 L310.26673485192305,81.75340378820957 L312.2820529705543,83.7285304543526 L314.26202759628075,85.73797240371925 L316.2060750183439,87.78109779039654 L318.11362281149604,89.85726484990651 L319.9841100043502,91.96582210060618 L321.8169872441392,94.1061085479413 L323.6117169578351,96.27745389149025 L325.36777350958135,98.47917873473305 L327.08464335439317,100.71059479748021 L328.76182518807946,102.97100513089477 L330.3988300933438,105.25970433504048 L331.99518168202167,107.57597877888827 L333.5504162334122,109.91910682271241 L335.06408282866533,112.28835904280723 L336.53574348118457,114.68299845845401 L337.9649732630081,117.10228076106812 L339.35136042713236,119.54545454545458 L340.6945065257419,122.0117615431006 L341.99402652431286,124.50043685743266 L343.24954891155716,127.01070920096467 L344.4607158051752,129.54180113426463 L345.627183053389,132.0929293066649 L346.7486203322251,134.66330469864192 L347.82471123852145,137.2521328657907 L348.8551533786315,139.85861418431813 L349.8396584528009,142.4819440979793 L350.7779523351935,145.12131336638134 L351.669775149545,147.775908314577 L352.5148813404228,150.44491108387209 L353.3130397400739,153.1274998837685 L354.06403363084144,155.82284924496642 L354.7676608031348,158.53013027334612 L355.4237336089369,161.24851090485322 L356.0320790108356,163.97715616120743 L356.59253862656647,166.71522840635689 L357.10496876905563,169.46188760359937 L357.5692404819532,172.21629157329116 L357.9852395706495,174.97759625106488 L358.3528666287657,177.7449559464768 L358.6720370601149,180.5175236020044 L358.9426810961295,183.29445105231503 L359.16474380874934,186.07488928372643 " />
6
+ <text stroke="#0160FF" fill="#0160FF" text-anchor="middle" dominant-baseline="middle" font-size="100" font-family="Arial" x="50%" y="50%">
7
+ 30
8
+ </text>
9
+ </svg>
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class SVG
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.2"
5
5
  end
data/lib/ruby-svg.rb CHANGED
@@ -8,7 +8,7 @@ class SVG
8
8
  attr_accessor(
9
9
  :filename, :tag, :attrs,
10
10
  :minx, :miny, :width, :height,
11
- :items, :stroke, :fill
11
+ :items
12
12
  )
13
13
 
14
14
  def self.open(tag=:svg, opts={}, &block)
@@ -19,9 +19,9 @@ class SVG
19
19
  new(tag, opts, &block).write
20
20
  end
21
21
 
22
- def self.register(method_name, &block)
23
- define_method(method_name) do |*attrs|
24
- block.call(self, *attrs)
22
+ def self.register(method_name, *arg_names, &block)
23
+ define_method(method_name) do |*arg_names, **attrs|
24
+ block.call(self, *arg_names, **attrs)
25
25
  end
26
26
  end
27
27
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-svg
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rocco Nicholls
@@ -21,9 +21,15 @@ files:
21
21
  - CHANGELOG.md
22
22
  - CODE_OF_CONDUCT.md
23
23
  - Gemfile
24
+ - Gemfile.lock
24
25
  - LICENSE.txt
25
26
  - README.md
26
27
  - Rakefile
28
+ - examples/helpers/point.rb
29
+ - examples/slime/generate.rb
30
+ - examples/slime/slime.svg
31
+ - examples/spiral/generate.rb
32
+ - examples/spiral/spiral.svg
27
33
  - lib/ruby-svg.rb
28
34
  - lib/ruby-svg/version.rb
29
35
  - sig/ruby-svg.rbs