victor 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +23 -5
- data/lib/victor/svg_base.rb +2 -1
- data/lib/victor/version.rb +1 -1
- data/lib/victor.rb +2 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ff2d91fe91857b10d35b9762dcbec3ee26ac3028c5522b7bdb33f73570a53422
|
4
|
+
data.tar.gz: b1fce99903fcf5cc4d1b024b48d8382046e4426c57bb7a621265abb3db187008
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 25eac4f567fa4b492bc9bded59d2194f2ac4c89283f71b748db2c8ccc3245793cdea7535131058282dace0fd366aa15f4e676414c2a2c823ea37d9f7777b01e4
|
7
|
+
data.tar.gz: 694d7f6ff8b2264aec64d3d2955751b9b375a0e25cc4b1aa35c6328de97ee6ce6996ff8744bc86bb5b50cb9ed712644c25431f2a7213b68a8ba05e5b1fdb9802
|
data/README.md
CHANGED
@@ -224,6 +224,23 @@ svg << other
|
|
224
224
|
svg.append other
|
225
225
|
```
|
226
226
|
|
227
|
+
To make this common use case a little easier to use, you can use a block when instantiating a new `SVG` object:
|
228
|
+
|
229
|
+
```ruby
|
230
|
+
troll = SVG.new do
|
231
|
+
circle cx: 50, cy: 60, r: 24, fill: 'yellow'
|
232
|
+
end
|
233
|
+
```
|
234
|
+
|
235
|
+
Which is the same as:
|
236
|
+
|
237
|
+
```ruby
|
238
|
+
troll = SVG.new
|
239
|
+
troll.build do
|
240
|
+
circle cx: 50, cy: 60, r: 24, fill: 'yellow'
|
241
|
+
end
|
242
|
+
```
|
243
|
+
|
227
244
|
Another approach to a more modular SVG composition, would be to subclass
|
228
245
|
`Victor::SVG`.
|
229
246
|
|
@@ -378,7 +395,7 @@ See the [xml encoding example](https://github.com/DannyBen/victor/tree/master/ex
|
|
378
395
|
|
379
396
|
### DSL Syntax
|
380
397
|
|
381
|
-
Victor supports
|
398
|
+
Victor also supports a DSL-like syntax. To use it, simply `require 'victor/script'`.
|
382
399
|
|
383
400
|
Once required, you have access to:
|
384
401
|
|
@@ -409,15 +426,16 @@ See the [example_rails](example_rails) folder.
|
|
409
426
|
|
410
427
|
## Related Projects
|
411
428
|
|
412
|
-
### [victor-cli]
|
429
|
+
### [Victor CLI][victor-cli]
|
413
430
|
|
414
|
-
A command line utility that
|
431
|
+
A command line utility that allows converting Ruby to SVG as well as SVG to
|
432
|
+
Victor Ruby scripts.
|
415
433
|
|
416
|
-
### [victor-opal]
|
434
|
+
### [Victor Opal][victor-opal]
|
417
435
|
|
418
436
|
A Victor playground that works in the browser.
|
419
437
|
|
420
|
-
### [Icodi]
|
438
|
+
### [Icodi][icodi]
|
421
439
|
|
422
440
|
A Ruby gem that uses Victor to generate consistent random icon
|
423
441
|
images, similar to GitHub's identicon.
|
data/lib/victor/svg_base.rb
CHANGED
@@ -4,10 +4,11 @@ module Victor
|
|
4
4
|
attr_accessor :template, :css
|
5
5
|
attr_reader :content, :svg_attributes
|
6
6
|
|
7
|
-
def initialize(attributes = nil)
|
7
|
+
def initialize(attributes = nil, &block)
|
8
8
|
setup attributes
|
9
9
|
@content = []
|
10
10
|
@css = {}
|
11
|
+
build &block if block_given?
|
11
12
|
end
|
12
13
|
|
13
14
|
def <<(additional_content)
|
data/lib/victor/version.rb
CHANGED
data/lib/victor.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: victor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Danny Ben Shitrit
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-05-05 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Build SVG images with ease
|
14
14
|
email: db@dannyben.com
|